]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add IS NOT DISTINCT FROM and IS DISTINCT FROM binary operators which are
authordrh <>
Thu, 12 May 2022 11:45:20 +0000 (11:45 +0000)
committerdrh <>
Thu, 12 May 2022 11:45:20 +0000 (11:45 +0000)
equivalent to IS and IS NOT, respectively, for compatability with PostgreSQL
and hence standard SQL.

FossilOrigin-Name: db27611e172102483eaede3981d473e3d5bf93d98bc68f480398b1573876349d

manifest
manifest.uuid
src/parse.y
test/expr.test

index 7f2a9c3b138075bca09e4756956c8202cb55165e..33ab7872197afdc41eeeef2c06fd1ddd2f2ab37c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\s".echo"\scommand\sof\sthe\sCLI\sso\sthat\sit\sshows\sthe\sresults\sof\sinput\nlines\simmediately,\sbefore\sinvoking\ssqlite3_prepare().
-D 2022-05-12T11:01:41.992
+C Add\sIS\sNOT\sDISTINCT\sFROM\sand\sIS\sDISTINCT\sFROM\sbinary\soperators\swhich\sare\nequivalent\sto\sIS\sand\sIS\sNOT,\srespectively,\sfor\scompatability\swith\sPostgreSQL\nand\shence\sstandard\sSQL.
+D 2022-05-12T11:45:20.320
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -542,7 +542,7 @@ F src/os_win.c a8ea80037e81127ca01959daa87387cc135f325c88dc745376c4f760de852a10
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c 42120492784fc9bcd9082b5c9b5e329b7318c357f9f3574a1bbfcf7418910356
 F src/pager.h f82e9844166e1585f5786837ddc7709966138ced17f568c16af7ccf946c2baa3
-F src/parse.y b86d56b446afb9c203d8354dc6c422818a62b4bbab52b76ab3da06d7b1d07e44
+F src/parse.y efcb41d403be7bcecd6a95e51f73f89043e768cd0650a392c9b7ee0edbf1cc67
 F src/pcache.c 084e638432c610f95aea72b8509f0845d2791293f39d1b82f0c0a7e089c3bb6b
 F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
 F src/pcache1.c 54881292a9a5db202b2c0ac541c5e3ef9a5e8c4f1c1383adb2601d5499a60e65
@@ -901,7 +901,7 @@ F test/exclusive.test 7ff63be7503990921838d5c9f77f6e33e68e48ed1a9d48cd28745bf650
 F test/exclusive2.test 984090e8e9d1b331d2e8111daf6e5d61dda0bef7
 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
 F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac
-F test/expr.test e1afcdb1038e4d3fa67a3df323347c38750946e2e1b4e385bdc75d26284f2dac
+F test/expr.test 5c06696478212e5a04e04b043f993373f6f8e5ce5a80f5548a84703b123b6caa
 F test/expr2.test c27327ae9c017a7ff6280123f67aff496f912da74d78c888926d68b46ec75fd8
 F test/exprfault.test 497cc0b8fe6a677f49b55cb485e040f709ec2834b84f25912fe9c2dfeeda33db
 F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9
@@ -1953,9 +1953,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d55273e36e312336b8fc77dc771657d3b2c3437fbbd79f3be37701982560d634 deb7372b18cc8fb9d305085498fd24b3c2c17bd920ae2d03fa885af02ad47008
-R 56f20e29d8d8bd4f94a878cd8e451873
-T +closed deb7372b18cc8fb9d305085498fd24b3c2c17bd920ae2d03fa885af02ad47008
+P cf7fdabdba3a7600ea730263ca80ba80154645dfa15c31c037b780d6cb70e530
+R 3d6af656fb4de79992bd7eb88f082265
 U drh
-Z cf10466c2750403d999365883982fc9d
+Z 3682303474f6dcc00e17a0b96d46c4cc
 # Remove this line to create a well-formed Fossil manifest.
index 8dd1a1187b3776a008c79e5f8706a247118c52d0..d36477989dd9cccd0aff9dbb0acf1daecc41fdf1 100644 (file)
@@ -1 +1 @@
-cf7fdabdba3a7600ea730263ca80ba80154645dfa15c31c037b780d6cb70e530
\ No newline at end of file
+db27611e172102483eaede3981d473e3d5bf93d98bc68f480398b1573876349d
\ No newline at end of file
index 37560a2e0b99f3971a49693c4366a4698c726ffb..565130a05cd4c188ace74b71893a95a28bd71ffa 100644 (file)
@@ -1218,6 +1218,14 @@ expr(A) ::= expr(A) IS NOT expr(Y). {
   A = sqlite3PExpr(pParse,TK_ISNOT,A,Y);
   binaryToUnaryIfNull(pParse, Y, A, TK_NOTNULL);
 }
+expr(A) ::= expr(A) IS NOT DISTINCT FROM expr(Y).     {
+  A = sqlite3PExpr(pParse,TK_IS,A,Y);
+  binaryToUnaryIfNull(pParse, Y, A, TK_ISNULL);
+}
+expr(A) ::= expr(A) IS DISTINCT FROM expr(Y). {
+  A = sqlite3PExpr(pParse,TK_ISNOT,A,Y);
+  binaryToUnaryIfNull(pParse, Y, A, TK_NOTNULL);
+}
 
 expr(A) ::= NOT(B) expr(X).  
               {A = sqlite3PExpr(pParse, @B, X, 0);/*A-overwrites-B*/}
index c64b6cb7061f0bf03c74573b0d5d233a91004552..55b1dc95021a435fc518b1289dff042e412655ac 100644 (file)
@@ -181,29 +181,53 @@ if {[working_64bit_int]} {
 }
 
 test_expr expr-1.111 {i1=NULL, i2=8} {i1 IS i2} 0
+test_expr expr-1.111b {i1=NULL, i2=8} {i1 IS NOT DISTINCT FROM i2} 0
 test_expr expr-1.112 {i1=NULL, i2=NULL} {i1 IS i2} 1
+test_expr expr-1.112b {i1=NULL, i2=NULL} {i1 IS NOT DISTINCT FROM i2} 1
 test_expr expr-1.113 {i1=6, i2=NULL} {i1 IS i2} 0
+test_expr expr-1.113b {i1=6, i2=NULL} {i1 IS NOT DISTINCT FROM i2} 0
 test_expr expr-1.114 {i1=6, i2=6} {i1 IS i2} 1
+test_expr expr-1.114b {i1=6, i2=6} {i1 IS NOT DISTINCT FROM i2} 1
 test_expr expr-1.115 {i1=NULL, i2=8} \
   {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} no
+test_expr expr-1.115b {i1=NULL, i2=8} \
+  {CASE WHEN i1 IS NOT DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} no
 test_expr expr-1.116 {i1=NULL, i2=NULL} \
   {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} yes
+test_expr expr-1.116b {i1=NULL, i2=NULL} \
+  {CASE WHEN i1 IS NOT DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} yes
 test_expr expr-1.117 {i1=6, i2=NULL} \
   {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} no
+test_expr expr-1.117b {i1=6, i2=NULL} \
+  {CASE WHEN i1 IS NOT DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} no
 test_expr expr-1.118 {i1=8, i2=8} \
   {CASE WHEN i1 IS i2 THEN 'yes' ELSE 'no' END} yes
+test_expr expr-1.118b {i1=8, i2=8} \
+  {CASE WHEN i1 IS NOT DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} yes
 test_expr expr-1.119 {i1=NULL, i2=8} {i1 IS NOT i2} 1
+test_expr expr-1.119b {i1=NULL, i2=8} {i1 IS DISTINCT FROM i2} 1
 test_expr expr-1.120 {i1=NULL, i2=NULL} {i1 IS NOT i2} 0
+test_expr expr-1.120b {i1=NULL, i2=NULL} {i1 IS DISTINCT FROM i2} 0
 test_expr expr-1.121 {i1=6, i2=NULL} {i1 IS NOT i2} 1
+test_expr expr-1.121b {i1=6, i2=NULL} {i1 IS DISTINCT FROM i2} 1
 test_expr expr-1.122 {i1=6, i2=6} {i1 IS NOT i2} 0
+test_expr expr-1.122b {i1=6, i2=6} {i1 IS DISTINCT FROM i2} 0
 test_expr expr-1.123 {i1=NULL, i2=8} \
   {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes
+test_expr expr-1.123b {i1=NULL, i2=8} \
+  {CASE WHEN i1 IS DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} yes
 test_expr expr-1.124 {i1=NULL, i2=NULL} \
   {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no
+test_expr expr-1.124b {i1=NULL, i2=NULL} \
+  {CASE WHEN i1 IS DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} no
 test_expr expr-1.125 {i1=6, i2=NULL} \
   {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} yes
+test_expr expr-1.125b {i1=6, i2=NULL} \
+  {CASE WHEN i1 IS DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} yes
 test_expr expr-1.126 {i1=8, i2=8} \
   {CASE WHEN i1 IS NOT i2 THEN 'yes' ELSE 'no' END} no
+test_expr expr-1.126b {i1=8, i2=8} \
+  {CASE WHEN i1 IS DISTINCT FROM i2 THEN 'yes' ELSE 'no' END} no
 
 do_catchsql_test expr-1.127 {
   SELECT 1 IS #1;