From: | david wheeler <hippysoyboy(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | IS as a binary operator |
Date: | 2023-02-25 10:38:38 |
Message-ID: | 4996BD98-0349-4871-B952-AFD8261920D0@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Heya folks,
Recently I've been using a Kotlin library SQLDelight <https://cashapp.github.io/sqldelight/2.0.0-alpha05/> which is great but has some issues with PostgreSQL support. In particular, for null parameters it converts `=` to `IS` - and it treats `IS` as a binary operator (rather than `IS NULL` unary operator), which Postgres doesn't like wrt prepared statements
prepare test(text) as (SELECT * FROM test WHERE nullable_col IS $1);
ERROR: syntax error at or near "$1"
LINE 1: ...epare test(text) as (SELECT * FROM test WHERE nullable_col IS $1);
full details at [1]
I’ve been working on a PR to use `IS NOT DISTINCT FROM` as the `=` substitution for nullable parameters rather than `IS`, however unfortunately that’s not universally supported either (MySQL).
Just wondering if anyone has other ideas? I guess there’s no interest in adding support for `IS` as basically an alias for `IS NOT DISTINCT FROM`? (and `IS NOT` for `IS DISTINCT FROM`)
TIA
David Wheeler
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-02-25 16:54:35 | Re: IS as a binary operator |
Previous Message | Stephen Frost | 2023-02-24 23:52:26 | Re: can't get psql authentication against Active Directory working |