© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•10mo ago
bc 🐧🪺

Generated Column Unique Constraint

The Drizzle docs on generated columns (https://orm.drizzle.team/docs/generated-columns), for Postgres, say "Cannot directly use in primary keys, foreign keys, or unique constraints"

Does this mean that generated columns cannot have unique constraints generated in the SQL?

The postgres docs (https://www.postgresql.org/docs/current/ddl-generated-columns.html) are linked, but I don't see any mention about unique constraints being unsupported there. Is this then a limitation of Drizzle, or is it a Postgres limitation after all?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Unique Constraint
Drizzle TeamDTDrizzle Team / help
16mo ago
conditional unique constraint
Drizzle TeamDTDrizzle Team / help
2y ago
Weird unique constraint
Drizzle TeamDTDrizzle Team / help
2y ago
MySQL unique constraint
Drizzle TeamDTDrizzle Team / help
3y ago