Drizzle Studio incompatibility with generatedAlwaysAsIdentity
Basically, https://discord.com/channels/1043890932593987624/1124768693549797416/1279077540266250334
If I define my primary key with
.generatedAlwaysAsIdentity()
, it seems like I can't add any records in Drizzle Studio because it tries to set the value of the column. This results in an error: cannot insert a non-DEFAULT value into column "id"
But I'm 0 days old when it comes to Drizzle, so maybe I'm missing something?8 Replies
db.insert(...).values({...})
because the id
column is required by Drizzle but forbidden by PostgreSQL. (Unless I do something ugly like id: sql`DEFAULT
. This isn't the case with serial
, so again I feel like I'm really missing something. Was any support added for identity columns beyond just creating them?I am using drizzle 0.33.0 and I don't have this error in my Typescript code. Are you using VScode? Can you give code example of your schema
If you're talking about the screenshot above, that's from the editor in Drizzle Studio. I think it's a minor issue compared to not being able to use the table editor to add rows, since you can just ignore the error and run the code anyway.
Here's a trivial case to reproduce this problem: https://github.com/masto/drizzle-studio-bug
GitHub
GitHub - masto/drizzle-studio-bug
Contribute to masto/drizzle-studio-bug development by creating an account on GitHub.
I can confirm this bug exists in Drizzle Kit Studio. Maybe you should raise an issue in the Drizzle Github
Thanks. I came here first to double check it was actually a problem because of my limited experience but it's pretty clear it's a thing, so I'll file an issue tomorrow.
GitHub
Drizzle Studio can't add records to PG table with generated identit...
If I define my primary key with .generatedAlwaysAsIdentity(), it seems like I can't add any records in Drizzle Studio because it tries to set the value of the column. This results in an error: ...