sl@0: # 2007 December 02 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. sl@0: # sl@0: # Specifically, it tests that bug 2817 is fixed. sl@0: # sl@0: # $Id: tkt2817.test,v 1.2 2008/07/12 14:52:21 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: do_test tkt2817-1.0 { sl@0: execsql { sl@0: CREATE TEMP TABLE tbl(a, b, c); sl@0: -- INSERT INTO tbl VALUES(1, 'abc', 'def'); sl@0: -- INSERT INTO tbl VALUES(2, 'ghi', 'jkl'); sl@0: } sl@0: } {} sl@0: do_test tkt2817-1.1 { sl@0: execsql { sl@0: CREATE TABLE main.tbl(a, b, c); sl@0: CREATE INDEX main.tbli ON tbl(a, b, c); sl@0: INSERT INTO main.tbl SELECT a, b, c FROM temp.tbl; sl@0: } sl@0: } {} sl@0: sl@0: # When bug #2817 existed, this test was failing. sl@0: # sl@0: integrity_check tkt2817-1.2 sl@0: sl@0: # So was this one. sl@0: # sl@0: db close sl@0: sqlite3 db test.db sl@0: integrity_check tkt2817-1.3 sl@0: sl@0: sl@0: # These tests - tkt2817-2.* - are the same as the previous block, except sl@0: # for the fact that the temp-table and the main table do not share the sl@0: # same name. #2817 did not cause a problem with these tests. sl@0: # sl@0: db close sl@0: file delete -force test.db sl@0: sqlite3 db test.db sl@0: do_test tkt2817-2.0 { sl@0: execsql { sl@0: CREATE TEMP TABLE tmp(a, b, c); sl@0: INSERT INTO tmp VALUES(1, 'abc', 'def'); sl@0: INSERT INTO tmp VALUES(2, 'ghi', 'jkl'); sl@0: } sl@0: } {} sl@0: do_test tkt2817-2.1 { sl@0: execsql { sl@0: CREATE TABLE main.tbl(a, b, c); sl@0: CREATE INDEX main.tbli ON tbl(a, b, c); sl@0: INSERT INTO main.tbl SELECT a, b, c FROM temp.tmp; sl@0: } sl@0: } {} sl@0: integrity_check tkt2817-2.2 sl@0: db close sl@0: sqlite3 db test.db sl@0: integrity_check tkt2817-2.3 sl@0: sl@0: finish_test