DEFAULT gen_random_uuid() in CREATE TABLE fails #9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
DEFAULT gen_random_uuid()in a column definition causes a SQLite syntax error:Workaround
Generate the UUID in the INSERT statement instead:
gen_random_uuid()works fine in queries and INSERT expressions — the issue is only in DDL DEFAULT clauses where the SQL rewriter does not translate the function call into SQLite-compatible syntax (DEFAULT (gen_random_uuid())or equivalent).Expected
The DDL translator should rewrite
DEFAULT gen_random_uuid()so it works against SQLite, matching PostgreSQL behaviour.Migrated from Codeberg: originally #9, opened 2026-04-13.