Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 6: The lib file to seed the db contains duplicate ID values #1005

Open
Razr6 opened this issue Feb 12, 2025 · 5 comments · May be fixed by #1013
Open

Chapter 6: The lib file to seed the db contains duplicate ID values #1005

Razr6 opened this issue Feb 12, 2025 · 5 comments · May be fixed by #1013

Comments

@Razr6
Copy link

Razr6 commented Feb 12, 2025

in placeholder-data.ts 👍

{
id: '3958dc9e-712f-4377-85e9-fec4b6a6442a',
name: 'Delba de Oliveira',
email: '[email protected]',
image_url: '/customers/delba-de-oliveira.png',
},
{
id: '3958dc9e-742f-4377-85e9-fec4b6a6442a',
name: 'Lee Robinson',
email: '[email protected]',
image_url: '/customers/lee-robinson.png',
},

because id must be unique, the db seeding fails, with the error (I am on Neon) of:

{
"error": {
"name": "PostgresError",
"severity_local": "ERROR",
"severity": "ERROR",
"code": "23505",
"detail": "Key (extname)=(uuid-ossp) already exists.",
"schema_name": "pg_catalog",
"table_name": "pg_extension",
"constraint_name": "pg_extension_name_index",
"file": "nbtinsert.c",
"line": "664",
"routine": "_bt_check_unique"
}
}

@Razr6 Razr6 changed the title The lib file to seed the db contains 2x customers with duplicate id Chapter 6: The lib file to seed the db contains duplicate ID values Feb 12, 2025
@DavidCWHung
Copy link

id: '3958dc9e-712f-4377-85e9-fec4b6a6442a', and id: '3958dc9e-742f-4377-85e9-fec4b6a6442a', seems different tho?

@leerob
Copy link
Member

leerob commented Feb 25, 2025

This might be because you're already ran the seeding process and the data is in the DB. Could you check?

@Razr6
Copy link
Author

Razr6 commented Feb 25, 2025

Sorry, I'm a newb and am just struggling my way through the tutorial, for the fourth time. I can't now tell if I had seeded it once or twice, when this happened.

When I first got the error, I looked about, looked in the db files and as far as I can I remember, the other tables had all seeded ok but the customer table was simply not there. And then I thought I had traced the problem back to the data in the placeholder-data.ts file. But as DavidCWHung points out the IDs are actually different - by just 1x character, buried in the middle of a 36 chr string (?).

Anyway. So I guess I was wrong. Looks like I am probably wasting your time here.

@w0244079
Copy link

@leerob I experienced the same issue today when doing the tutorial...I've sent along a PR (#1013) for review which when applied fixed the problem for me....hope it helps.

@chrissygonzalez
Copy link

I also ran into problems seeding (somehow missing the invoice in the chapter 6 query, and fewer than expected customers). @w0244079 Your fix worked for me, thank you. I can move on to chapter 7 now 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants