3 ms·
What database is this specific to? PostgreSQL? Those first two are entirely invalid in T-SQL. Even attempting to write it as SELECT IIF(NULL AND 1=1, 1, 0) doe
by ziml77 2y ago
What database is this specific to? PostgreSQL?
Those first two are entirely invalid in T-SQL. Even attempting to write it as SELECT IIF(NULL AND 1=1, 1, 0) doesn't work. The AND operation can only be applied to a boolean type and the only way to get that is as the result of a comparison and it can't be stored or passed anywhere.
Also the UNIQUE constraint does not allow insert of a second NULL. I tried that both using the constraint syntax and by creating a unique index.
- Izkata 2y agoYeah, it looks like postgres to me. Nothing pops out as incompatible, and I got 17/22.
- pavel_lishin 2y agoIn mysql, a unique constraint will not prevent multiple nulls in that column.
- mau013 2y agoIn Postgres you can chose whether to treat NULLs as distinct or not (meaning that when treating NULLs as NOT DISTINCT you can insert many for an otherwise unique row). If I’m not mistaken this is the docs page: https://www.postgresql.org/docs/current/indexes-unique.html https://www.postgresql.org/docs/current/indexes-unique.html