mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
Fix bug with CHECK constraints contain an IN operator. Ticket #1645. (CVS 3035)
FossilOrigin-Name: 944df310ce8d32798135c70becee7845676520ae
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\sa\scouple\sof\s(harmless)\sintel\scompiler\swarnings.\s(CVS\s3034)
|
C Fix\sbug\swith\sCHECK\sconstraints\scontain\san\sIN\soperator.\s\sTicket\s#1645.\s(CVS\s3035)
|
||||||
D 2006-01-27T06:32:00
|
D 2006-01-30T14:36:59
|
||||||
F Makefile.in e936c6fc3134838318aa0335a85041e6da31f6ee
|
F Makefile.in e936c6fc3134838318aa0335a85041e6da31f6ee
|
||||||
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
|
||||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||||
@@ -42,7 +42,7 @@ F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
|||||||
F src/date.c c70a4f88e495ae2c523f6ef3848c26a021c96de8
|
F src/date.c c70a4f88e495ae2c523f6ef3848c26a021c96de8
|
||||||
F src/delete.c 56ab34c3a384caa5d5ea06f5739944957e2e4213
|
F src/delete.c 56ab34c3a384caa5d5ea06f5739944957e2e4213
|
||||||
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
|
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
|
||||||
F src/expr.c cda707cc5e55394b1597493b8e2456aa18bdaaa0
|
F src/expr.c 1149c3380bfce27703f5e9bec7dfb8e51baaf9d9
|
||||||
F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
|
F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
|
||||||
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
|
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
|
||||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||||
@@ -165,7 +165,7 @@ F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
|
|||||||
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
|
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
|
||||||
F test/func.test 337888172c054c2de1aa3bacad6115522943dc2c
|
F test/func.test 337888172c054c2de1aa3bacad6115522943dc2c
|
||||||
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
|
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
|
||||||
F test/in.test cead6165aebbe0d451bb2263a307173acfeb6240
|
F test/in.test 40feeebc7e38576255051aad428322be1545e0f1
|
||||||
F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
|
F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
|
||||||
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
|
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
|
||||||
F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
|
F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
|
||||||
@@ -347,7 +347,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
|||||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||||
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
|
||||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||||
P 7ccebf68eb1f707c2349004ae33575b484cc31a2
|
P 2e23231f0c10b2bba9e08ea47859e2c0ffa84c76
|
||||||
R af3a62a74947b66d5764f2eab77a8c84
|
R 3b0f9d35458ab8f6669640d2d99a201a
|
||||||
U danielk1977
|
U drh
|
||||||
Z b88f808b21bcdeecec76ffb8f4e035ac
|
Z da68d113e790373b1b3d356e0a8d22c5
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2e23231f0c10b2bba9e08ea47859e2c0ffa84c76
|
944df310ce8d32798135c70becee7845676520ae
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** 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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -1699,6 +1699,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
|
|||||||
case TK_IN: {
|
case TK_IN: {
|
||||||
int addr;
|
int addr;
|
||||||
char affinity;
|
char affinity;
|
||||||
|
int ckOffset = pParse->ckOffset;
|
||||||
sqlite3CodeSubselect(pParse, pExpr);
|
sqlite3CodeSubselect(pParse, pExpr);
|
||||||
|
|
||||||
/* Figure out the affinity to use to create a key from the results
|
/* 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);
|
affinity = comparisonAffinity(pExpr);
|
||||||
|
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
|
||||||
|
pParse->ckOffset = ckOffset+1;
|
||||||
|
|
||||||
/* Code the <expr> from "<expr> IN (...)". The temporary table
|
/* Code the <expr> from "<expr> IN (...)". The temporary table
|
||||||
** pExpr->iTable contains the values that make up the (...) set.
|
** pExpr->iTable contains the values that make up the (...) set.
|
||||||
|
|||||||
21
test/in.test
21
test/in.test
@@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this file is testing the IN and BETWEEN operator.
|
# 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]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
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}}
|
} {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
|
finish_test
|
||||||
|
|||||||
Reference in New Issue
Block a user