2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A# The author disclaims copyright to this source code. In place of
2N/A# a legal notice, here is a blessing:
2N/A# May you do good and not evil.
2N/A# May you find forgiveness for yourself and forgive others.
2N/A# May you share freely, never taking more than you give.
2N/A#***********************************************************************
2N/A# This file implements regression tests for SQLite library.
2N/A# This file implements tests for miscellanous features that were
2N/A# left out of other test files.
2N/Aset testdir [file dirname $argv0]
2N/A# Test for ticket #360
2N/A CREATE TABLE FOO(bar integer);
2N/A CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN
2N/A THEN raise(rollback, 'aiieee') END;
2N/A INSERT INTO foo(bar) VALUES (1);
2N/A INSERT INTO foo(bar) VALUES (111);
2N/A# Make sure ROWID works on a view and a subquery. Ticket #364
2N/A CREATE TABLE t1(a,b,c);
2N/A INSERT INTO t1 VALUES(1,2,3);
2N/A CREATE TABLE t2(a,b,c);
2N/A INSERT INTO t2 VALUES(7,8,9);
2N/A SELECT rowid, * FROM (SELECT * FROM t1, t2);
2N/A CREATE VIEW v1 AS SELECT * FROM t1, t2;
2N/A SELECT rowid, * FROM v1;
2N/A# Check name binding precedence. Ticket #387
2N/A} {1 {ambiguous column name: a}}
2N/A# Make sure 32-bit integer overflow is handled properly in queries.
2N/A INSERT INTO t1 VALUES(4000000000,'a','b');
2N/A SELECT a FROM t1 WHERE a>1;
2N/A INSERT INTO t1 VALUES(2147483648,'b2','c2');
2N/A INSERT INTO t1 VALUES(2147483647,'b3','c3');
2N/A SELECT a FROM t1 WHERE a>2147483647;
2N/A} {4000000000 2147483648}
2N/A SELECT a FROM t1 WHERE a<2147483648;
2N/A SELECT a FROM t1 WHERE a<=2147483648;
2N/A} {1 2147483648 2147483647}
2N/A SELECT a FROM t1 WHERE a<10000000000;
2N/A} {1 4000000000 2147483648 2147483647}
2N/A SELECT a FROM t1 WHERE a<1000000000000 ORDER BY 1;
2N/A} {1 2147483647 2147483648 4000000000}
2N/A# There were some issues with expanding a SrcList object using a call
2N/A# to sqliteSrcListAppend() if the SrcList had previously been duplicated
2N/A# using a call to sqliteSrcListDup(). Ticket #416. The following test
2N/A# makes sure the problem has been fixed.
2N/A CREATE TABLE x(a,b);
2N/A# Make sure we can open a database with an empty filename. What this
2N/A# does is store the database in a temporary file that is deleted when
2N/A# the database is closed. Ticket #432.
2N/A CREATE TABLE t1(a,b);
2N/A INSERT INTO t1 VALUES(1,2);
2N/A# Make sure we get an error message (not a segfault) on an attempt to
2N/A# update a table from within the callback of a select on that same
2N/A INSERT INTO t1 VALUES(1);
2N/A db eval {SELECT rowid FROM t1} {} {
2N/A db eval "DELETE FROM t1 WHERE rowid=$rowid"
2N/A} {1 {database table is locked}}
2N/A db eval {SELECT rowid FROM t1} {} {
2N/A db eval "INSERT INTO t1 VALUES(3)"
2N/A} {1 {database table is locked}}
2N/A INSERT INTO t1 VALUES(1);
2N/A db eval {SELECT rowid FROM t1} {} {
2N/A db eval "DELETE FROM t1 WHERE rowid=$rowid"
2N/A} {1 {database table is locked}}
2N/A db eval {SELECT rowid FROM t1} {} {
2N/A db eval "INSERT INTO t1 VALUES(3)"
2N/A} {1 {database table is locked}}
2N/A# Ticket #453. If the SQL ended with "-", the tokenizer was calling that
2N/A# an incomplete token, which caused problem. The solution was to just call
2N/A} {1 {near "-": syntax error}}
2N/A# Ticket #513. Make sure the VDBE stack does not grow on a 3-way join.
2N/A CREATE TABLE counts(n INTEGER PRIMARY KEY);
2N/A INSERT INTO counts VALUES(0);
2N/A INSERT INTO counts VALUES(1);
2N/A INSERT INTO counts SELECT n+2 FROM counts;
2N/A INSERT INTO counts SELECT n+4 FROM counts;
2N/A INSERT INTO counts SELECT n+8 FROM counts;
2N/A CREATE TEMP TABLE x AS
2N/A FROM counts AS dim1, counts AS dim2, counts AS dim3
2N/A SELECT count(*) FROM x;
2N/A CREATE TEMP TABLE x AS
2N/A FROM counts AS dim1, counts AS dim2, counts AS dim3
2N/A SELECT count(*) FROM x;
2N/A CREATE TEMP TABLE x AS
2N/A FROM counts AS dim1, counts AS dim2, counts AS dim3, counts AS dim4
2N/A SELECT count(*) FROM x;