mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Manifest types in indices. At the moment indices use manifest typing, but
some other parts of the SQL engine do not, which can lead to some strange results. (CVS 1368) FossilOrigin-Name: 9f2b6d9d3a07e25fcdb7e8290da7a182a65c37b2
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the INSERT statement.
|
||||
#
|
||||
# $Id: insert.test,v 1.16 2004/05/11 09:50:02 danielk1977 Exp $
|
||||
# $Id: insert.test,v 1.17 2004/05/13 05:16:17 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -145,13 +145,17 @@ do_test insert-3.1 {
|
||||
SELECT * from test2;
|
||||
}
|
||||
} {}
|
||||
|
||||
# Update for sqlite v3:
|
||||
# Change the 111 to '111' in the following two test cases, because
|
||||
# the default value is being inserted as a string. TODO: It shouldn't be.
|
||||
do_test insert-3.2 {
|
||||
execsql {INSERT INTO test2(f2,f4) VALUES(-3.33,'hum')}
|
||||
execsql {SELECT * FROM test2 WHERE f1=111 AND f2=-3.33}
|
||||
execsql {SELECT * FROM test2 WHERE f1='111' AND f2=-3.33}
|
||||
} {111 -3.33 hi hum {}}
|
||||
do_test insert-3.3 {
|
||||
execsql {INSERT INTO test2(f1,f2,f5) VALUES(22,-4.44,'wham')}
|
||||
execsql {SELECT * FROM test2 WHERE f1=111 AND f2=-3.33}
|
||||
execsql {SELECT * FROM test2 WHERE f1='111' AND f2=-3.33}
|
||||
} {111 -3.33 hi hum {}}
|
||||
do_test insert-3.4 {
|
||||
execsql {SELECT * FROM test2 WHERE f1=22 AND f2=-4.44}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
#
|
||||
# $Id: select2.test,v 1.18 2002/04/02 13:26:11 drh Exp $
|
||||
# $Id: select2.test,v 1.19 2004/05/13 05:16:17 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -83,24 +83,26 @@ do_test select2-3.1 {
|
||||
execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}
|
||||
} {500}
|
||||
|
||||
# SQLite v3: Change the expressions in the following four test cases
|
||||
# from 1000=f2 to '1000'=f2. This is because fields read in using
|
||||
# the COPY command have manifest type TEXT.
|
||||
do_test select2-3.2a {
|
||||
execsql {CREATE INDEX idx1 ON tbl2(f2)}
|
||||
} {}
|
||||
|
||||
do_test select2-3.2b {
|
||||
execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}
|
||||
execsql {SELECT f1 FROM tbl2 WHERE '1000'=f2}
|
||||
} {500}
|
||||
do_test select2-3.2c {
|
||||
execsql {SELECT f1 FROM tbl2 WHERE f2=1000}
|
||||
execsql {SELECT f1 FROM tbl2 WHERE f2='1000'}
|
||||
} {500}
|
||||
do_test select2-3.2d {
|
||||
set sqlite_search_count 0
|
||||
execsql {SELECT * FROM tbl2 WHERE 1000=f2}
|
||||
execsql {SELECT * FROM tbl2 WHERE '1000'=f2}
|
||||
set sqlite_search_count
|
||||
} {3}
|
||||
do_test select2-3.2e {
|
||||
set sqlite_search_count 0
|
||||
execsql {SELECT * FROM tbl2 WHERE f2=1000}
|
||||
execsql {SELECT * FROM tbl2 WHERE f2='1000'}
|
||||
set sqlite_search_count
|
||||
} {3}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# focus of this file is testing UNION, INTERSECT and EXCEPT operators
|
||||
# in SELECT statements.
|
||||
#
|
||||
# $Id: select4.test,v 1.13 2003/02/02 12:41:27 drh Exp $
|
||||
# $Id: select4.test,v 1.14 2004/05/13 05:16:17 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -196,9 +196,14 @@ do_test select4-4.1.1 {
|
||||
ORDER BY log;
|
||||
}
|
||||
} {5}
|
||||
|
||||
# Update for sqlite 3:
|
||||
# Change the "UNION ALL SELECT 6" in each of the select statements
|
||||
# for the next three test cases to "UNION ALL SELECT '6'". This is
|
||||
# to accomadate manifest typing.
|
||||
do_test select4-4.1.2 {
|
||||
execsql {
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT 6
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT '6'
|
||||
INTERSECT
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
@ -207,7 +212,7 @@ do_test select4-4.1.2 {
|
||||
do_test select4-4.1.3 {
|
||||
execsql {
|
||||
CREATE TABLE t2 AS
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT 6
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT '6'
|
||||
INTERSECT
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
@ -218,7 +223,7 @@ execsql {DROP TABLE t2}
|
||||
do_test select4-4.1.4 {
|
||||
execsql {
|
||||
CREATE TABLE t2 AS
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT 6
|
||||
SELECT DISTINCT log FROM t1 UNION ALL SELECT '6'
|
||||
INTERSECT
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log DESC;
|
||||
@ -469,16 +474,18 @@ do_test select4-7.4 {
|
||||
|
||||
# Make sure DISTINCT works appropriately on TEXT and NUMERIC columns.
|
||||
#
|
||||
# Update for sqlite v3:
|
||||
# Insert X+0.0 instead of X to make sure X has manifest type NUMERIC.
|
||||
do_test select4-8.1 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
CREATE TABLE t3(a text, b float, c text);
|
||||
INSERT INTO t3 VALUES(1, 1.1, '1.1');
|
||||
INSERT INTO t3 VALUES(2, 1.10, '1.10');
|
||||
INSERT INTO t3 VALUES(3, 1.10, '1.1');
|
||||
INSERT INTO t3 VALUES(4, 1.1, '1.10');
|
||||
INSERT INTO t3 VALUES(5, 1.2, '1.2');
|
||||
INSERT INTO t3 VALUES(6, 1.3, '1.3');
|
||||
INSERT INTO t3 VALUES(1, 1.1 + 0.0, '1.1');
|
||||
INSERT INTO t3 VALUES(2, 1.10 + 0.0, '1.10');
|
||||
INSERT INTO t3 VALUES(3, 1.10 + 0.0, '1.1');
|
||||
INSERT INTO t3 VALUES(4, 1.1 + 0.0, '1.10');
|
||||
INSERT INTO t3 VALUES(5, 1.2 + 0.0, '1.2');
|
||||
INSERT INTO t3 VALUES(6, 1.3 + 0.0, '1.3');
|
||||
COMMIT;
|
||||
}
|
||||
execsql {
|
||||
|
Reference in New Issue
Block a user