]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix bug with CHECK constraints contain an IN operator. Ticket #1645. (CVS 3035)
authordrh <drh@noemail.net>
Mon, 30 Jan 2006 14:36:59 +0000 (14:36 +0000)
committerdrh <drh@noemail.net>
Mon, 30 Jan 2006 14:36:59 +0000 (14:36 +0000)
FossilOrigin-Name: 944df310ce8d32798135c70becee7845676520ae

manifest
manifest.uuid
src/expr.c
test/in.test

index e843601a262bed8867db2d104021302c93034f21..e1b2462938d95bf4f82f3570f51945e76a5582a6 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\scouple\sof\s(harmless)\sintel\scompiler\swarnings.\s(CVS\s3034)
-D 2006-01-27T06:32:00
+C Fix\sbug\swith\sCHECK\sconstraints\scontain\san\sIN\soperator.\s\sTicket\s#1645.\s(CVS\s3035)
+D 2006-01-30T14:36:59
 F Makefile.in e936c6fc3134838318aa0335a85041e6da31f6ee
 F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -42,7 +42,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
 F src/date.c c70a4f88e495ae2c523f6ef3848c26a021c96de8
 F src/delete.c 56ab34c3a384caa5d5ea06f5739944957e2e4213
 F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
-F src/expr.c cda707cc5e55394b1597493b8e2456aa18bdaaa0
+F src/expr.c 1149c3380bfce27703f5e9bec7dfb8e51baaf9d9
 F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
 F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
@@ -165,7 +165,7 @@ F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
 F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
 F test/func.test 337888172c054c2de1aa3bacad6115522943dc2c
 F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
-F test/in.test cead6165aebbe0d451bb2263a307173acfeb6240
+F test/in.test 40feeebc7e38576255051aad428322be1545e0f1
 F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
 F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
 F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
@@ -347,7 +347,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 7ccebf68eb1f707c2349004ae33575b484cc31a2
-R af3a62a74947b66d5764f2eab77a8c84
-U danielk1977
-Z b88f808b21bcdeecec76ffb8f4e035ac
+P 2e23231f0c10b2bba9e08ea47859e2c0ffa84c76
+R 3b0f9d35458ab8f6669640d2d99a201a
+U drh
+Z da68d113e790373b1b3d356e0a8d22c5
index c7b4d635e33e3de36676e1c6bfb6febe718c767d..f14dd4fa19f51bef66246f749e72f7e43fabc5bf 100644 (file)
@@ -1 +1 @@
-2e23231f0c10b2bba9e08ea47859e2c0ffa84c76
\ No newline at end of file
+944df310ce8d32798135c70becee7845676520ae
\ No newline at end of file
index 7de7583ad0c0c0e1952f4b17f05858d32cc40442..9a1e046334fada42c59c3fd7fc11a4caf47f32b2 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.252 2006/01/24 12:09:19 danielk1977 Exp $
+** $Id: expr.c,v 1.253 2006/01/30 14:36:59 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -1699,6 +1699,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
     case TK_IN: {
       int addr;
       char affinity;
+      int ckOffset = pParse->ckOffset;
       sqlite3CodeSubselect(pParse, pExpr);
 
       /* Figure out the affinity to use to create a key from the results
@@ -1708,6 +1709,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
       affinity = comparisonAffinity(pExpr);
 
       sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
+      pParse->ckOffset = ckOffset+1;
 
       /* Code the <expr> from "<expr> IN (...)". The temporary table
       ** pExpr->iTable contains the values that make up the (...) set.
index 37d8792c7b41ac6be1bbfbf6bc0b6606ec58dbc6..02b0ec593c97242ef3ad573904d5545fb8ecb02b 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing the IN and BETWEEN operator.
 #
-# $Id: in.test,v 1.14 2005/07/08 18:25:26 drh Exp $
+# $Id: in.test,v 1.15 2006/01/30 14:36:59 drh Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -304,4 +304,23 @@ do_test in-9.4 {
   }
 } {1 {only a single result allowed for a SELECT that is part of an expression}}
 
+# IN clauses in CHECK constraints.  Ticket #1645
+#
+do_test in-10.1 {
+  execsql {
+    CREATE TABLE t5(
+      a INTEGER,
+      CHECK( a IN (111,222,333) )
+    );
+    INSERT INTO t5 VALUES(111);
+    SELECT * FROM t5;
+  }
+} {111}
+do_test in-10.2 {
+  catchsql {
+    INSERT INTO t5 VALUES(4);
+  }
+} {1 {constraint failed}}
+
+
 finish_test