Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
24.68k
stars
651
forks
source link
[BUG]: `for("update", { noWait: true })` yields invalid SQL: `syntax error at or near "no"` #3554
Open
jelder opened 1 week ago
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.23.0
What version of
drizzle-kit
are you using?0.32.1-848e136
Other packages
No response
Describe the Bug
Given something like this, where
tx
is a Drizzle transaction.The resulting SQL looks like
That will result in the error
syntax error at or near "no"
because Postgres spells this option as a single word:This is confusing because the other option here is spelled as two words:
Fortunately this can be fixed by simply removing this space: https://github.com/drizzle-team/drizzle-orm/blob/2677718bf98835b8ec313d0f3bf2b921e795e7c1/drizzle-orm/src/pg-core/dialect.ts#L391-L392
Relevant Postgres documentation: https://www.postgresql.org/docs/16/sql-select.html#:~:text=The%20locking%20clause%20has,%5B%2C%20...%5D%20%5D%20%5B%20NOWAIT%20%7C%20SKIP%20LOCKED%20%5D