3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the CREATE INDEX statement.
14 # $Id: index3.test,v 1.3 2008/03/19 13:03:34 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 # Ticket #1115. Make sure that when a UNIQUE index is created on a
21 # non-unique column (or columns) that it fails and that it leaves no
27 INSERT INTO t1 VALUES(1);
28 INSERT INTO t1 VALUES(1);
35 CREATE UNIQUE INDEX i1 ON t1(a);
37 } {1 {UNIQUE constraint failed: t1.a}}
41 integrity_check index3-1.4
43 # This test corrupts the database file so it must be the last test
48 PRAGMA writable_schema=on;
49 UPDATE sqlite_master SET sql='nonsense';
52 catch { sqlite3 db test.db }
53 catchsql { DROP INDEX i1 }
54 } {1 {malformed database schema (t1) - near "nonsense": syntax error}}