blob: 579cf2f7ba62fd7b606a8ef0251b87c6e5bbe837 [file] [log] [blame]
danielk1977fe910332007-12-02 11:46:34 +00001# 2007 December 02
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library.
12#
13# Specifically, it tests that bug 2817 is fixed.
14#
drhe8f52c52008-07-12 14:52:20 +000015# $Id: tkt2817.test,v 1.2 2008/07/12 14:52:21 drh Exp $
danielk1977fe910332007-12-02 11:46:34 +000016
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20do_test tkt2817-1.0 {
21 execsql {
22 CREATE TEMP TABLE tbl(a, b, c);
23 -- INSERT INTO tbl VALUES(1, 'abc', 'def');
24 -- INSERT INTO tbl VALUES(2, 'ghi', 'jkl');
25 }
26} {}
27do_test tkt2817-1.1 {
28 execsql {
29 CREATE TABLE main.tbl(a, b, c);
30 CREATE INDEX main.tbli ON tbl(a, b, c);
31 INSERT INTO main.tbl SELECT a, b, c FROM temp.tbl;
32 }
33} {}
34
35# When bug #2817 existed, this test was failing.
36#
37integrity_check tkt2817-1.2
38
39# So was this one.
40#
41db close
42sqlite3 db test.db
43integrity_check tkt2817-1.3
44
45
46# These tests - tkt2817-2.* - are the same as the previous block, except
47# for the fact that the temp-table and the main table do not share the
48# same name. #2817 did not cause a problem with these tests.
49#
50db close
mistachkinfda06be2011-08-02 00:57:34 +000051forcedelete test.db
danielk1977fe910332007-12-02 11:46:34 +000052sqlite3 db test.db
53do_test tkt2817-2.0 {
54 execsql {
55 CREATE TEMP TABLE tmp(a, b, c);
56 INSERT INTO tmp VALUES(1, 'abc', 'def');
57 INSERT INTO tmp VALUES(2, 'ghi', 'jkl');
58 }
59} {}
60do_test tkt2817-2.1 {
61 execsql {
62 CREATE TABLE main.tbl(a, b, c);
63 CREATE INDEX main.tbli ON tbl(a, b, c);
64 INSERT INTO main.tbl SELECT a, b, c FROM temp.tmp;
65 }
66} {}
67integrity_check tkt2817-2.2
68db close
69sqlite3 db test.db
70integrity_check tkt2817-2.3
71
72finish_test