ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

add support for IS [NOT] DISTINCT FROM #54

Closed cyberhuman closed 6 years ago

cyberhuman commented 6 years ago

The standard SQL is IS [NOT] DISTINCT FROM, and it's supported by at least Postgre and Firebird.

MySQL uses <=> instead of IS NOT DISTINCT FROM: https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#operator_equal-to

mysql> select 0 <=> 0, 0 <=> null, null <=> 0, null <=> null;
+---------+------------+------------+---------------+
| 0 <=> 0 | 0 <=> null | null <=> 0 | null <=> null |
+---------+------------+------------+---------------+
|       1 |          0 |          0 |             1 |
+---------+------------+------------+---------------+
1 row in set (0.00 sec)

sqlite uses IS and IS NOT instead of IS NOT DISTINCT FROM and IS DISTINCT FROM, respectively:

sqlite> select 0 is 0, 0 is null, null is 0, null is null
1|0|0|1
ygrek commented 6 years ago

Thanks for extensive description

cyberhuman commented 6 years ago

Thank you :+1: