From: danielk1977 Date: Wed, 27 Jun 2007 17:09:24 +0000 (+0000) Subject: Test error handling when renaming fts2 tables. (CVS 4144) X-Git-Tag: version-3.6.10~2030 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c5588605926ebd9e2e1545a3c4d0752fd92c2a4;p=thirdparty%2Fsqlite.git Test error handling when renaming fts2 tables. (CVS 4144) FossilOrigin-Name: 57840eba6a4380a0b71dc9514cdda41e2c455bb0 --- diff --git a/manifest b/manifest index 1a45e1d593..92d6853bac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Implement\sxRename()\sfor\sfts2\sso\sthat\sit\sis\spossible\sto\srename\sfts2\stables.\s(CVS\s4143) -D 2007-06-27T16:26:07 +C Test\serror\shandling\swhen\srenaming\sfts2\stables.\s(CVS\s4144) +D 2007-06-27T17:09:24 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -62,7 +62,7 @@ F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2 F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a -F src/alter.c 3402b657de80c242b0382f768df273505f8178cc +F src/alter.c 24c81ed6734304326922d42430567d1ee368c81d F src/analyze.c 8d345472e0f4e44fc88f5cf489c16dcb77904525 F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37 F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb @@ -255,7 +255,7 @@ F test/fts2k.test 222d0b3bc8667753f18406aaea9906a6098ea016 F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3 F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51 F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638 -F test/fts2o.test fc65e2b5c25136649bff46de061cdcad4ab08287 +F test/fts2o.test ceac3203cd5d62c0402dcce89d5e28bae5d7481e F test/fts2token.test d8070b241a15ff13592a9ae4a8b7c171af6f445a F test/func.test 605989453d1b42cec1d05c17aa232dc98e3e04e6 F test/fuzz.test 62fc19dd36a427777fd671b569df07166548628a @@ -517,7 +517,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 37d1f9f37ea9d2e8a4dbe0ec67c0d6eb7fcc5f3f -R 061154b74d9142e5c4c143483f77f02b +P 488474fde753c5a7a14ed8f2fad7f16efd236491 +R 4f60da6efe6e8d95948cdc14fa0709df U danielk1977 -Z 168b383abe5caa1cd0194ed13c2b238e +Z 7f85be68408492be44f5d735b8a75673 diff --git a/manifest.uuid b/manifest.uuid index e56c286633..f54fa9169a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -488474fde753c5a7a14ed8f2fad7f16efd236491 \ No newline at end of file +57840eba6a4380a0b71dc9514cdda41e2c455bb0 \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index d93da8f299..b8c767a632 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.26 2007/06/27 15:53:35 danielk1977 Exp $ +** $Id: alter.c,v 1.27 2007/06/27 17:09:24 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -321,6 +321,9 @@ void sqlite3AlterRenameTable( #endif #ifndef SQLITE_OMIT_VIRTUALTABLE + if( sqlite3ViewGetColumnNames(pParse, pTab) ){ + goto exit_rename_table; + } if( IsVirtual(pTab) && pTab->pMod->pModule->xRename ){ isVirtualRename = 1; } diff --git a/test/fts2o.test b/test/fts2o.test index f121538c73..d571ea81d0 100644 --- a/test/fts2o.test +++ b/test/fts2o.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the FTS2 module. # -# $Id: fts2o.test,v 1.2 2007/06/27 16:26:07 danielk1977 Exp $ +# $Id: fts2o.test,v 1.3 2007/06/27 17:09:25 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -62,5 +62,44 @@ do_test fts2o-2.4 { execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'} } {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir} +# See what happens when renaming the fts2 table fails. +# +do_test fts2o-2.5 { + catchsql { + CREATE TABLE t1_segdir(a, b, c); + ALTER TABLE fts_t1 RENAME to t1; + } +} {1 {SQL logic error or missing database}} +do_test fts2o-2.6 { + execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; } +} {1 {one three four}} +do_test fts2o-2.7 { + execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'} +} {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir t1_segdir} + +# See what happens when renaming the fts2 table fails inside a transaction. +# +do_test fts2o-2.8 { + execsql { + BEGIN; + INSERT INTO fts_t1(a, b, c) VALUES('one two three', 'one four', 'one two'); + } +} {} +do_test fts2o-2.9 { + catchsql { + ALTER TABLE fts_t1 RENAME to t1; + } +} {1 {SQL logic error or missing database}} +do_test fts2o-2.10 { + execsql { SELECT rowid, snippet(fts_t1) FROM fts_t1 WHERE a MATCH 'four'; } +} {1 {one three four}} +do_test fts2o-2.11 { + execsql { SELECT tbl_name FROM sqlite_master WHERE type = 'table'} +} {fts_t1 fts_t1_content fts_t1_segments fts_t1_segdir t1_segdir} +do_test fts2o-2.12 { + execsql COMMIT + execsql {SELECT a FROM fts_t1} +} {{one three four} {one two three}} + finish_test