]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Multiplying NULL by zero gives NULL, not zero. I misread the test data
authordrh <drh@noemail.net>
Sat, 1 Jun 2002 21:41:10 +0000 (21:41 +0000)
committerdrh <drh@noemail.net>
Sat, 1 Jun 2002 21:41:10 +0000 (21:41 +0000)
and coded it wrong.  This check-in fixes the problem. (CVS 601)

FossilOrigin-Name: df9cc852ad02dbec5558d3915a0303f7e7b79b2b

manifest
manifest.uuid
src/vdbe.c
test/null.test

index 00c200d7f1a9d724dd759605140f4c9652b0c80b..fd0af44d60f0744494d4f4fd6263deeb7ddb6afc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Refinements\sto\sNULL\sprocessing:\sNULLs\sare\sindistinct\sfor\sDISTINCT\sand\sUNION.\nMultiplying\sa\sNULL\sby\szero\syields\szero.\sIn\sa\sCASE\sexpression,\sa\sNULL\scomparison\nis\sconsidered\sfalse,\snot\sNULL.\s\sWith\sthese\schanges,\sNULLs\sin\sSQLite\snow\swork\nthe\ssame\sas\sin\sPostgreSQL\sand\sin\sOracle.\s(CVS\s600)
-D 2002-05-31T15:51:25
+C Multiplying\sNULL\sby\szero\sgives\sNULL,\snot\szero.\s\sI\smisread\sthe\stest\sdata\nand\scoded\sit\swrong.\s\sThis\scheck-in\sfixes\sthe\sproblem.\s(CVS\s601)
+D 2002-06-01T21:41:10
 F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
 F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
@@ -52,7 +52,7 @@ F src/tokenize.c facec7dc0b4a13e17ad67702f548dac2f7c6a732
 F src/trigger.c d02f8e3510c7c2ad948a0e8c3bb0cca8adaf80c5
 F src/update.c f68375173bf5338cae3e97012708e10f206aedd9
 F src/util.c 7cf46b5612f5d12601c697374b9c6b38b2332ce8
-F src/vdbe.c 81ae0a1ce59d56fd4180cb8b20018c67b43d0423
+F src/vdbe.c ee08fbae7f7bfc150b5840ce69967c469c440752
 F src/vdbe.h b8706429131c14b307a07aab7e47f95a9da53610
 F src/where.c b054f2f23127bd57eb5f973bcd38764b875d73fe
 F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
@@ -80,7 +80,7 @@ F test/minmax.test 29bc5727c3e4c792d5c4745833dd4b505905819e
 F test/misc1.test df281e9b26cd1db5808939c7cf2703072d555be0
 F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
 F test/notnull.test b1f3e42fc475b0b5827b27b2e9b562081995ff30
-F test/null.test 732b4ec96e1c1a10b2bc3e1008c8f1da1cc0fb30
+F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
 F test/pager.test b0c0d00cd5dce0ce21f16926956b195c0ab5044c
 F test/pragma.test 0b9675ef1f5ba5b43abfa337744445fc5b01a34a
 F test/printf.test 3cb415073754cb8ff076f26173143c3cd293a9da
@@ -136,7 +136,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
 F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 7a24336d50e72006b2cc0e4feb292b946e79d5f3
-R fa5694968411297d416326c538e47fd0
+P da61aa1d238539dff9c43fd9f464d311e28d669f
+R f5c3f541431552f938b5386e692916f8
 U drh
-Z 4ea8ccf14bc3e954bee7c679e23f1161
+Z 64d47e65013a776dcf32882cb49edbc6
index 87ebcca7f688714c8fca64e8988301ae19d7eec7..1659a80ea64f797359693328fdab4fa9173455b7 100644 (file)
@@ -1 +1 @@
-da61aa1d238539dff9c43fd9f464d311e28d669f
\ No newline at end of file
+df9cc852ad02dbec5558d3915a0303f7e7b79b2b
\ No newline at end of file
index 3cf545279c8eeb009f59c8ddb0ddde939671a4d4..d3cce40b05323f4c228ff75343dd7e3e02c4ee49 100644 (file)
@@ -30,7 +30,7 @@
 ** But other routines are also provided to help in building up
 ** a program instruction by instruction.
 **
-** $Id: vdbe.c,v 1.151 2002/05/31 15:51:26 drh Exp $
+** $Id: vdbe.c,v 1.152 2002/06/01 21:41:10 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1769,28 +1769,9 @@ case OP_Remainder: {
   int nos = tos - 1;
   VERIFY( if( nos<0 ) goto not_enough_stack; )
   if( ((aStack[tos].flags | aStack[nos].flags) & STK_Null)!=0 ){
-    int resultType = STK_Null;
-    if( pOp->opcode==OP_Multiply ){
-      /* Special case: multiplying NULL by zero gives a zero result, not a
-      ** NULL result as it would normally. */
-      if( (aStack[tos].flags & (STK_Int|STK_Real))!=0
-              || ((aStack[tos].flags & STK_Str)!=0 && isNumber(zStack[tos])) ){
-        Integerify(p,tos);
-        if( aStack[tos].i==0 ){
-          resultType = STK_Int;
-          aStack[nos].i = 0;
-        }
-      }else if( (aStack[nos].flags & (STK_Int|STK_Real))!=0
-              || ((aStack[nos].flags & STK_Str)!=0 && isNumber(zStack[nos])) ){
-        Integerify(p,nos);
-        if( aStack[nos].i==0 ){
-          resultType = STK_Int;
-        }
-      }
-    }
     POPSTACK;
     Release(p, nos);
-    aStack[nos].flags = resultType;
+    aStack[nos].flags = STK_Null;
   }else if( (aStack[tos].flags & aStack[nos].flags & STK_Int)==STK_Int ){
     int a, b;
     a = aStack[tos].i;
index 1f3fe7212d2e6e70ca3f78ef771e38f572a3510e..61128acc8ffd0894032d963a9358227e583b5aa3 100644 (file)
@@ -46,12 +46,7 @@ do_test null-1.2 {
   execsql {
     select ifnull(b*c,99) from t1;
   }
-} {0 0 0 1 0 99 99}
-do_test null-1.2.1 {
-  execsql {
-    select ifnull(c*b,99) from t1;
-  }
-} {0 0 0 1 0 99 99}
+} {0 0 0 1 99 99 99}
 
 # Check to see how the CASE expression handles NULL values.  The
 # first WHEN for which the test expression is TRUE is selected.