-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report hasn't been filed before.
- I have verified that the bug I'm about to report hasn't been filed before.
What version of drizzle-orm
are you using?
0.44.4
What version of drizzle-kit
are you using?
0.31.4
Other packages
No response
Describe the Bug
When using Drizzle's operator wrappers eq
and isNull
(or isNotNull
), no parantheses are generated to explicitly declare an evaluation precedence.
The call to
eq(foo, isNull(bar))
evaluates to
foo = bar is null
which is incorrect when targeting Postgres >= 9.5.
The operator precedence given in the PostgreSQL documentation ranks equality (=
) above IS NULL
so parantheses would be necessary here:
foo = (bar is null)
As a result, the expressions eq(foo, isNull(bar))
and isNull(eq(foo, bar))
are currently equivalent as they both evaluate to foo = bar is null
.
I assume that at least the current MySQL and SQLite versions are also affected, where these operators have the same precedence (which means the bug only appears half of the time, depending on the written order).
pikaju
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working