-C Turn\sof\sthe\sreporting\sof\sdatatypes\sin\sthe\s4th\scallback\sargument\sunless\sthe\nSHOW_DATATYPES\spragma\sis\sON.\s\sEliminate\sthe\sNULL\spointer\sthat\sused\sto\sseparate\nthe\sbeginning\sof\sdatatypes\sfrom\sthe\send\sof\scolumn\snames\sso\sthat\sthe\scallback\ncan\stest\sto\ssee\swhether\sor\snot\sdatatypes\sare\sprovided.\s\sThis\sis\san\nincompatible\schanges,\sbut\ssince\sthe\sprior\sbehavior\swas\snever\sdocumented,\swe\nwill\slet\sit\sin.\s(CVS\s670)
-D 2002-07-11T12:18:16
+C Fix\sfor\sticket\s#95:\sDo\snot\sallow\sautomatically\screated\sindices\s(associated\nwith\sUNIQUE\sor\sPRIMARY\sKEY\sconstraints)\sto\sbe\sdropped.\s(CVS\s671)
+D 2002-07-13T03:11:53
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
F src/btree.c db8cd1bd46cd30a1763c3cc80602571d1b30a329
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
-F src/build.c d8318cd8aa1d8175740515e3b2bc55f6f8ad512d
+F src/build.c 58ce73da93699bbbe676908678e1e44bad1853cb
F src/delete.c 215492ffcea4262a993e55f3c4a67dc9fea4da9c
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
F src/expr.c 4b25ee5e65f351d40dea8575b998605762556d76
F src/shell.c 16cb2db27f2d3045f78e74e83bac965a8249357b
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
-F src/sqliteInt.h a4f79f88e6b2cf970a8ea91c0a2c32430bbd0a7d
+F src/sqliteInt.h 943209263393dcbaf1e753b83a0f33258f090a5f
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c ba454c5166252a55cb4db8af4d29d2a18b6e6f3d
F src/test1.c 456cb080db85056be723e770435d9509afc3a83a
F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f
F test/func.test cae5f27e09736cfdcc978c3719ac1345405b848c
F test/in.test e59461f1702b7387880bf08a0ce6bb777925d282
-F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
+F test/index.test 1a69532e7868eddac61c679fd03f46b5666214da
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
F test/insert2.test c288375a64dad3295044714f0dfed4a193cf067f
F test/intpkey.test 69a6a9b41e541f27a2ffcd20264fb35adc3c2680
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P ff8b6f4ee8099a7170cb786b8ead9a3e42ab5869
-R 4c9a5cc2cec864756c678ced0f23d593
+P b98727246d5fcc1b097b577be498a77e954c5dc4
+R 63ac9211f1b05cfcd7456d042d50424a
U drh
-Z 840152c064bf52b6a31a6b9344474a04
+Z 55a586e46b5f7dee263dd374af92bd39
-b98727246d5fcc1b097b577be498a77e954c5dc4
\ No newline at end of file
+0603eb74e6aca48f62bd95cb6c236b9e559af850
\ No newline at end of file
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.103 2002/07/11 12:18:16 drh Exp $
+** $Id: build.c,v 1.104 2002/07/13 03:11:53 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
pIndex->pTable = pTab;
pIndex->nColumn = pList->nId;
pIndex->onError = pIndex->isUnique = onError;
+ pIndex->autoIndex = pName==0;
/* Scan the names of the columns of the table to be indexed and
** load the column indices into the Index structure. Report an error
pParse->nErr++;
return;
}
+ if( pIndex->autoIndex ){
+ sqliteSetString(&pParse->zErrMsg, "index associated with UNIQUE "
+ "or PRIMARY KEY constraint cannot be dropped", 0);
+ pParse->nErr++;
+ return;
+ }
/* Generate code to remove the index and from the master table */
v = sqliteGetVdbe(pParse);
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.136 2002/07/11 12:18:17 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.137 2002/07/13 03:11:54 drh Exp $
*/
#include "sqlite.h"
#include "hash.h"
int tnum; /* Page containing root of this index in database file */
u8 isUnique; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
+ u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
Index *pNext; /* The next index associated with the same table */
};
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement.
#
-# $Id: index.test,v 1.17 2001/11/24 00:31:47 drh Exp $
+# $Id: index.test,v 1.18 2002/07/13 03:11:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {0.0 0.00 abc +1.0 0 00000}
+# Make sure we cannot drop an automatically created index.
+#
+do_test index-13.1 {
+ execsql {
+ CREATE TABLE t5(
+ a int UNIQUE,
+ b float PRIMARY KEY,
+ c varchar(10),
+ UNIQUE(a,c)
+ );
+ INSERT INTO t5 VALUES(1,2,3);
+ SELECT * FROM t5;
+ }
+} {1 2 3}
+do_test index-13.2 {
+ set ::idxlist [execsql {
+ SELECT name FROM sqlite_master WHERE type="index" AND tbl_name="t5";
+ }]
+ llength $::idxlist
+} {3}
+for {set i 0} {$i<[llength $::idxlist]} {incr i} {
+ do_test index-13.3.$i {
+ catchsql "
+ DROP INDEX '[lindex $::idxlist $i]';
+ "
+ } {1 {index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped}}
+}
+do_test index-13.4 {
+ execsql {
+ INSERT INTO t5 VALUES('a','b','c');
+ SELECT * FROM t5;
+ }
+} {1 2 3 a b c}
+
finish_test