]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Ensure b-tree mutexes are always held when sqlite3FindTable() is called. Do
authordan <dan@noemail.net>
Fri, 31 Aug 2018 18:23:53 +0000 (18:23 +0000)
committerdan <dan@noemail.net>
Fri, 31 Aug 2018 18:23:53 +0000 (18:23 +0000)
not invoke the authorizer callback when parsing schema items as part of ALTER
TABLE commands. Fix test script issues.

FossilOrigin-Name: eac2aa7dce577f1998cc2078dd8ac384070f8acf1ceb565999a5cf719092024e

manifest
manifest.uuid
src/alter.c
test/alter.test
test/fkey2.test
test/without_rowid3.test

index 1c3355c32e39d20b22daa48896b5edf24156a153..41d6f1d9f0a9e0dbcade2b1e90acaea249f44847 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Test\sthe\sschema\safter\srenaming\sa\stable.\sEnsure\sthat\stemp\sdatabase\striggers\sand\nviews\sare\supdated\swhen\srenaming\sa\scolumn.
-D 2018-08-30T20:03:44.965
+C Ensure\sb-tree\smutexes\sare\salways\sheld\swhen\ssqlite3FindTable()\sis\scalled.\sDo\nnot\sinvoke\sthe\sauthorizer\scallback\swhen\sparsing\sschema\sitems\sas\spart\sof\sALTER\nTABLE\scommands.\sFix\stest\sscript\sissues.
+D 2018-08-31T18:23:53.268
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 2729786d5d188974913f07ea63cc84cd42cb9cac5f4aac823c40105e68e22f63
@@ -432,7 +432,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
 F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
 F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
-F src/alter.c 5ff9eba02edd4fb3635fee57593de12d8f9a8c926e1ae6a42d86f2881dd61229
+F src/alter.c 6fa0efb035dd6c1633c9b54425bbf65f89a402d131beffb93979686b21b7ec4e
 F src/analyze.c 3dc6b98cf007b005af89df165c966baaa48e8124f38c87b4d2b276fe7f0b9eb9
 F src/attach.c 4bd5b92633671d3e8ce431153ebb1893b50335818423b5373f3f27969f79769a
 F src/auth.c 32a5bbe3b755169ab6c66311c5225a3cd4f75a46c041f7fb117e0cbb68055114
@@ -595,7 +595,7 @@ F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 18b00de006597e960a6b27ccec51474ac66cf1070a87c1933e5694dc02190ef1
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test ae17c4412639e16bd797c7617864a16c2badc0035c808ae8246f145e38f8e2f9
-F test/alter.test 8388947daa6caee09f624242d5907dbb0c0da6704cb40c44a6a1c1b4119142ed
+F test/alter.test 31b4e9128887457f1a7bdfea4764513204e88f09e33e89bc32b84fdd3d21229a
 F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060
 F test/alter3.test 4d79934d812eaeacc6f22781a080f8cfe012fdc3
 F test/alter4.test b6d7b86860111864f6cddb54af313f5862dda23b
@@ -819,7 +819,7 @@ F test/fallocate.test 07416bd593a116d5893cb244f45a94d5c6fe030561df3bd972e6135f81
 F test/filectrl.test 6e871c2d35dead1d9a88e176e8d2ca094fec6bb3
 F test/filefmt.test f393e80c4b8d493b7a7f8f3809a8425bbf4292af1f5140f01cb1427798a2bbd4
 F test/fkey1.test d11dbb8a93ead9b5c46ae5d02da016d61245d47662fb2d844c99214f6163f768
-F test/fkey2.test 155809016fad6b2a1491facf2ac53a551bc57c2c
+F test/fkey2.test f2e5a7691c1df789267777d58eec78aa6efb803d709e5aa09d2b9a0a4a5cdfbd
 F test/fkey3.test 76d475c80b84ee7a5d062e56ccb6ea68882e2b49
 F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
 F test/fkey5.test 24dd28eb3d9f1b5a174f47e9899ace5facb08373a4223593c8c631e6cf9f7d5a
@@ -1650,7 +1650,7 @@ F test/with4.test 257be66c0c67fee1defbbac0f685c3465e2cad037f21ce65f23f86084f1982
 F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
 F test/without_rowid1.test 533add9100255e4cc430d371b3ecfb79f11f956b86c3a1b9d34413bf8e482d8f
 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
-F test/without_rowid3.test 2724c787a51a5dce09d078453a758117b4b728f1
+F test/without_rowid3.test ca4b1e58b35c27313b06d2df87a7f24efb2fe394b4176acbf0d718ef5d6b10d7
 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
 F test/without_rowid5.test 89b1c587bd92a0590e440da33e7666bf4891572a
 F test/without_rowid6.test 1f99644e6508447fb050f73697350c7ceca3392e
@@ -1759,7 +1759,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 72cfb1be29971d91a164f1d4f20cb054de68960a0bd547630bcd1160565971c5
-R 79fac94bb61d9aa70a424b0f3bdeede1
+P f3c27d916d4837f8fc3dd812bd004535f04c7a53bd2a0a2419613275f48bec76
+R 81cc7609c3c0787876d931405d4b6723
 U dan
-Z 2a5b5dbe0b0f3a53631f87af8692d7e9
+Z 6c4368e1a20fe0bd9edcc5b54d5e689a
index 5582d3422267d1aaad85e00afb082cfd5222cfe3..72d62c1913ca8f0a741f45519d57e3fb79f5a296 100644 (file)
@@ -1 +1 @@
-f3c27d916d4837f8fc3dd812bd004535f04c7a53bd2a0a2419613275f48bec76
\ No newline at end of file
+eac2aa7dce577f1998cc2078dd8ac384070f8acf1ceb565999a5cf719092024e
\ No newline at end of file
index 113404cfed450d4ff3ea191f44ee44ee9e35053e..666c3caf4627483da4d70e35fdaab8e3aabdd6df 100644 (file)
@@ -1162,6 +1162,19 @@ static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){
   }
 }
 
+static void renameParseCleanup(Parse *pParse){
+  sqlite3 *db = pParse->db;
+  if( pParse->pVdbe ){
+    sqlite3VdbeFinalize(pParse->pVdbe);
+  }
+  sqlite3DeleteTable(db, pParse->pNewTable);
+  if( pParse->pNewIndex ) sqlite3FreeIndex(db, pParse->pNewIndex);
+  sqlite3DeleteTrigger(db, pParse->pNewTrigger);
+  sqlite3DbFree(db, pParse->zErrMsg);
+  renameTokenFree(db, pParse->pRename);
+  sqlite3ParserReset(pParse);
+}
+
 /*
 ** SQL function:
 **
@@ -1208,16 +1221,17 @@ static void renameColumnFunc(
   int bQuote = sqlite3_value_int(argv[7]);
   const char *zOld;
   int bTemp = 0;
-
   int rc;
   char *zErr = 0;
   Parse sParse;
   Walker sWalker;
   Index *pIdx;
   char *zOut = 0;
-
   int i;
   Table *pTab;
+#ifndef SQLITE_OMIT_AUTHORIZATION
+  sqlite3_xauth xAuth = db->xAuth;
+#endif
 
   UNUSED_PARAMETER(NotUsed);
   if( zSql==0 ) return;
@@ -1234,6 +1248,9 @@ static void renameColumnFunc(
   memset(&sCtx, 0, sizeof(sCtx));
   sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol);
 
+#ifndef SQLITE_OMIT_AUTHORIZATION
+  db->xAuth = 0;
+#endif
   rc = renameParseSql(&sParse, zDb, 0, db, zSql, bTemp);
 
   /* Find tokens that need to be replaced. */
@@ -1332,16 +1349,11 @@ renameColumnFunc_done:
     }
   }
 
-  if( sParse.pVdbe ){
-    sqlite3VdbeFinalize(sParse.pVdbe);
-  }
-  sqlite3DeleteTable(db, sParse.pNewTable);
-  if( sParse.pNewIndex ) sqlite3FreeIndex(db, sParse.pNewIndex);
-  sqlite3DeleteTrigger(db, sParse.pNewTrigger);
-  renameTokenFree(db, sParse.pRename);
+  renameParseCleanup(&sParse);
   renameTokenFree(db, sCtx.pList);
-  sqlite3DbFree(db, sParse.zErrMsg);
-  sqlite3ParserReset(&sParse);
+#ifndef SQLITE_OMIT_AUTHORIZATION
+  db->xAuth = xAuth;
+#endif
   sqlite3BtreeLeaveAll(db);
 }
 
@@ -1377,13 +1389,15 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){
 ** of any foreign key constraints that use the table being renamed as the 
 ** parent table. It is passed three arguments:
 **
-**   1) The complete text of the CREATE TABLE statement being modified,
-**   2) The old name of the table being renamed, and
-**   3) The new name of the table being renamed.
+**   0: The database containing the table being renamed.
+**   1: The complete text of the schema statement being modified,
+**   2: The old name of the table being renamed, and
+**   3: The new name of the table being renamed.
+**   4: True if the schema statement comes from the temp db.
 **
-** It returns the new CREATE TABLE statement. For example:
+** It returns the new schema statement. For example:
 **
-**   sqlite_rename_table('CREATE TABLE t1(a REFERENCES t2)', 't2', 't3')
+** sqlite_rename_table('main', 'CREATE TABLE t1(a REFERENCES t2)','t2','t3',0)
 **       -> 'CREATE TABLE t1(a REFERENCES t3)'
 */
 static void renameTableFunc(
@@ -1400,110 +1414,110 @@ static void renameTableFunc(
   unsigned char const *zNew = sqlite3_value_text(argv[3]);
   int bTemp = sqlite3_value_int(argv[4]);
 
-  unsigned const char *z;         /* Pointer to token */
-  int n;                          /* Length of token z */
-  int token;                      /* Type of token */
+  if( zInput && zOld && zNew ){
+    unsigned const char *z;         /* Pointer to token */
+    int n;                          /* Length of token z */
+    int token;                      /* Type of token */
 
-  Parse sParse;
-  int rc;
-  int bQuote = 1;
-  RenameCtx sCtx;
-  Walker sWalker;
+    Parse sParse;
+    int rc;
+    int bQuote = 1;
+    RenameCtx sCtx;
+    Walker sWalker;
 
-  if( zInput==0 || zOld==0 || zNew==0 ) return;
+#ifndef SQLITE_OMIT_AUTHORIZATION
+    sqlite3_xauth xAuth = db->xAuth;
+    db->xAuth = 0;
+#endif
 
-  memset(&sCtx, 0, sizeof(RenameCtx));
-  sCtx.pTab = sqlite3FindTable(db, zOld, zDb);
-  memset(&sWalker, 0, sizeof(Walker));
-  sWalker.pParse = &sParse;
-  sWalker.xExprCallback = renameTableExprCb;
-  sWalker.xSelectCallback = renameTableSelectCb;
-  sWalker.u.pRename = &sCtx;
+    sqlite3BtreeEnterAll(db);
 
-  sqlite3BtreeEnterAll(db);
+    memset(&sCtx, 0, sizeof(RenameCtx));
+    sCtx.pTab = sqlite3FindTable(db, zOld, zDb);
+    memset(&sWalker, 0, sizeof(Walker));
+    sWalker.pParse = &sParse;
+    sWalker.xExprCallback = renameTableExprCb;
+    sWalker.xSelectCallback = renameTableSelectCb;
+    sWalker.u.pRename = &sCtx;
 
-  rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
+    rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
 
-  if( rc==SQLITE_OK ){
-    if( sParse.pNewTable ){
-      Table *pTab = sParse.pNewTable;
+    if( rc==SQLITE_OK ){
+      if( sParse.pNewTable ){
+        Table *pTab = sParse.pNewTable;
 
-      if( pTab->pSelect ){
-        NameContext sNC;
-        memset(&sNC, 0, sizeof(sNC));
-        sNC.pParse = &sParse;
+        if( pTab->pSelect ){
+          NameContext sNC;
+          memset(&sNC, 0, sizeof(sNC));
+          sNC.pParse = &sParse;
 
-        sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
-        if( sParse.nErr ) rc = sParse.rc;
-        sqlite3WalkSelect(&sWalker, pTab->pSelect);
-      }else{
-        /* Modify any FK definitions to point to the new table. */
+          sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);
+          if( sParse.nErr ) rc = sParse.rc;
+          sqlite3WalkSelect(&sWalker, pTab->pSelect);
+        }else{
+          /* Modify any FK definitions to point to the new table. */
 #ifndef SQLITE_OMIT_FOREIGN_KEY
-        FKey *pFKey;
-        for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
-          if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){
-            renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo);
+          FKey *pFKey;
+          for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
+            if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){
+              renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo);
+            }
           }
-        }
 #endif
 
-        /* If this is the table being altered, fix any table refs in CHECK
-        ** expressions. Also update the name that appears right after the
-        ** "CREATE [VIRTUAL] TABLE" bit. */
-        if( sqlite3_stricmp(zOld, pTab->zName)==0 ){
-          sCtx.pTab = pTab;
-          sqlite3WalkExprList(&sWalker, pTab->pCheck);
-          renameTokenFind(&sParse, &sCtx, pTab->zName);
+          /* If this is the table being altered, fix any table refs in CHECK
+          ** expressions. Also update the name that appears right after the
+          ** "CREATE [VIRTUAL] TABLE" bit. */
+          if( sqlite3_stricmp(zOld, pTab->zName)==0 ){
+            sCtx.pTab = pTab;
+            sqlite3WalkExprList(&sWalker, pTab->pCheck);
+            renameTokenFind(&sParse, &sCtx, pTab->zName);
+          }
         }
       }
-    }
 
-    else if( sParse.pNewIndex ){
-      renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName);
-      sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
-    }
+      else if( sParse.pNewIndex ){
+        renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName);
+        sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);
+      }
 
 #ifndef SQLITE_OMIT_TRIGGER
-    else if( sParse.pNewTrigger ){
-      Trigger *pTrigger = sParse.pNewTrigger;
-      TriggerStep *pStep;
-      if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) 
-       && sCtx.pTab->pSchema==pTrigger->pTabSchema
-      ){
-        renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table);
-      }
+      else if( sParse.pNewTrigger ){
+        Trigger *pTrigger = sParse.pNewTrigger;
+        TriggerStep *pStep;
+        if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) 
+            && sCtx.pTab->pSchema==pTrigger->pTabSchema
+          ){
+          renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table);
+        }
 
-      rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
-      if( rc==SQLITE_OK ){
-        renameWalkTrigger(&sWalker, pTrigger);
-        for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
-          if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
-            renameTokenFind(&sParse, &sCtx, pStep->zTarget);
+        rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
+        if( rc==SQLITE_OK ){
+          renameWalkTrigger(&sWalker, pTrigger);
+          for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
+            if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
+              renameTokenFind(&sParse, &sCtx, pStep->zTarget);
+            }
           }
         }
       }
-    }
 #endif
-  }
+    }
 
-  if( rc==SQLITE_OK ){
-    rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
-  }
+    if( rc==SQLITE_OK ){
+      rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
+    }
+    if( rc!=SQLITE_OK ){
+      sqlite3_result_error_code(context, rc);
+    }
 
-  if( rc!=SQLITE_OK ){
-    sqlite3_result_error_code(context, rc);
-  }
-  if( sParse.pVdbe ){
-    sqlite3VdbeFinalize(sParse.pVdbe);
+    renameParseCleanup(&sParse);
+    renameTokenFree(db, sCtx.pList);
+    sqlite3BtreeLeaveAll(db);
+#ifndef SQLITE_OMIT_AUTHORIZATION
+    db->xAuth = xAuth;
+#endif
   }
-  sqlite3DeleteTable(db, sParse.pNewTable);
-  if( sParse.pNewIndex ) sqlite3FreeIndex(db, sParse.pNewIndex);
-  sqlite3DeleteTrigger(db, sParse.pNewTrigger);
-  renameTokenFree(db, sParse.pRename);
-  renameTokenFree(db, sCtx.pList);
-  sqlite3DbFree(db, sParse.zErrMsg);
-  sqlite3ParserReset(&sParse);
-  sqlite3BtreeLeaveAll(db);
 
   return;
 }
@@ -1520,6 +1534,11 @@ static void renameTableTest(
   int rc;
   Parse sParse;
 
+#ifndef SQLITE_OMIT_AUTHORIZATION
+  sqlite3_xauth xAuth = db->xAuth;
+  db->xAuth = 0;
+#endif
+
   rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);
   if( rc==SQLITE_OK ){
     if( sParse.pNewTable && sParse.pNewTable->pSelect ){
@@ -1538,16 +1557,11 @@ static void renameTableTest(
   if( rc!=SQLITE_OK ){
     renameColumnParseError(context, 1, argv[2], argv[3], &sParse);
   }
+  renameParseCleanup(&sParse);
 
-  if( sParse.pVdbe ){
-    sqlite3VdbeFinalize(sParse.pVdbe);
-  }
-  sqlite3DeleteTable(db, sParse.pNewTable);
-  if( sParse.pNewIndex ) sqlite3FreeIndex(db, sParse.pNewIndex);
-  sqlite3DeleteTrigger(db, sParse.pNewTrigger);
-  sqlite3DbFree(db, sParse.zErrMsg);
-  renameTokenFree(db, sParse.pRename);
-  sqlite3ParserReset(&sParse);
+#ifndef SQLITE_OMIT_AUTHORIZATION
+  db->xAuth = xAuth;
+#endif
 }
 
 /*
index 4e6b6da7396e2c71c5f3a4eb5685a1089baa41ad..1b337af8704c01ab7d16908e00f00852e3abd7f5 100644 (file)
@@ -681,21 +681,19 @@ do_test alter-8.2 {
 } {1 18 2 9}
 
 #--------------------------------------------------------------------------
-# alter-9.X - Special test: Make sure the sqlite_rename_trigger() and
+# alter-9.X - Special test: Make sure the sqlite_rename_column() and
 # rename_table() functions do not crash when handed bad input.
 #
-ifcapable trigger {
-  do_test alter-9.1 {
-    execsql {SELECT SQLITE_RENAME_TRIGGER(0,0)}
-  } {{}}
+do_test alter-9.1 {
+  execsql {SELECT SQLITE_RENAME_COLUMN(0,0,0,0,0,0,0,0)}
+} {{}}
+foreach {tn sql} {
+    1 { SELECT SQLITE_RENAME_TABLE(0,0,0,0,0) }
+    2 { SELECT SQLITE_RENAME_TABLE(10,20,30,40,50) }
+    3 { SELECT SQLITE_RENAME_TABLE('foo', 'foo', 'foo', 'foo', 'foo') }
+} {
+  do_catchsql_test alter-9.2.$tn $sql {1 {SQL logic error}}
 }
-do_test alter-9.2 {
-  execsql {
-    SELECT SQLITE_RENAME_TABLE(0,0);
-    SELECT SQLITE_RENAME_TABLE(10,20);
-    SELECT SQLITE_RENAME_TABLE('foo', 'foo');
-  }
-} {{} {} {}}
 
 #------------------------------------------------------------------------
 # alter-10.X - Make sure ALTER TABLE works with multi-byte UTF-8 characters 
@@ -875,51 +873,5 @@ do_execsql_test alter-16.2 {
   SELECT * FROM t16a_rn ORDER BY a;
 } {abc 1.25 99 xyzzy cba 5.5 98 fizzle}
 
-#-------------------------------------------------------------------------
-# Verify that NULL values into the internal-use-only sqlite_rename_*()
-# functions do not cause problems.
-#
-do_execsql_test alter-17.1 {
-  SELECT sqlite_rename_table('CREATE TABLE xyz(a,b,c)','abc');
-} {{CREATE TABLE "abc"(a,b,c)}}
-do_execsql_test alter-17.2 {
-  SELECT sqlite_rename_table('CREATE TABLE xyz(a,b,c)',NULL);
-} {{CREATE TABLE "(NULL)"(a,b,c)}}
-do_execsql_test alter-17.3 {
-  SELECT sqlite_rename_table(NULL,'abc');
-} {{}}
-do_execsql_test alter-17.4 {
-  SELECT sqlite_rename_trigger('CREATE TRIGGER r1 ON xyz WHEN','abc');
-} {{CREATE TRIGGER r1 ON "abc" WHEN}}
-do_execsql_test alter-17.5 {
-  SELECT sqlite_rename_trigger('CREATE TRIGGER r1 ON xyz WHEN',NULL);
-} {{CREATE TRIGGER r1 ON "(NULL)" WHEN}}
-do_execsql_test alter-17.6 {
-  SELECT sqlite_rename_trigger(NULL,'abc');
-} {{}}
-do_execsql_test alter-17.7 {
-  SELECT sqlite_rename_parent('main', 'CREATE TABLE t1(a REFERENCES "xyzzy")',
-         'xyzzy','lmnop');
-} {{CREATE TABLE t1(a REFERENCES "lmnop")}}
-do_execsql_test alter-17.8 {
-  SELECT sqlite_rename_parent('main', 'CREATE TABLE t1(a REFERENCES "xyzzy")',
-         'xyzzy',NULL);
-} {{}}
-do_execsql_test alter-17.9 {
-  SELECT sqlite_rename_parent('main', 'CREATE TABLE t1(a REFERENCES "xyzzy")',
-         NULL, 'lmnop');
-} {{}}
-do_execsql_test alter-17.10 {
-  SELECT sqlite_rename_parent('main', NULL,'abc','xyz');
-} {{}}
-do_catchsql_test alter-17.11 {
-  SELECT sqlite_rename_parent('main', 'create references ''','abc','xyz');
-} {1 {SQL logic error}}
-do_catchsql_test alter-17.12 {
-  SELECT sqlite_rename_parent('main', 'create references "abc"123" ','abc','xyz');
-} {1 {SQL logic error}}
-do_catchsql_test alter-17.13 {
-  SELECT sqlite_rename_parent('main', "references '''",'abc','xyz');
-} {1 {SQL logic error}}
-
 finish_test
+
index c2ae3788f5b0a7b010f3e1696f9a19004cfb5e5b..5959e1844741a56864815ae3c1fcf8b3472926ff 100644 (file)
@@ -983,7 +983,7 @@ ifcapable altertable {
   # Test the sqlite_rename_parent() function directly.
   #
   proc test_rename_parent {zCreate zOld zNew} {
-    db eval {SELECT sqlite_rename_parent($zCreate, $zOld, $zNew)}
+    db eval {SELECT sqlite_rename_table('main', $zCreate, $zOld, $zNew, 0)}
   }
   do_test fkey2-14.2.1.1 {
     test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t2 t3
index 387a213b99e239cd47547973ffb6146741ae3c0b..8b25c676de0f7fc3af6fef2a0f4cfe1afab8fa80 100644 (file)
@@ -949,7 +949,7 @@ ifcapable altertable {
   # Test the sqlite_rename_parent() function directly.
   #
   proc test_rename_parent {zCreate zOld zNew} {
-    db eval {SELECT sqlite_rename_parent($zCreate, $zOld, $zNew)}
+    db eval {SELECT sqlite_rename_table('main', $zCreate, $zOld, $zNew, 0)}
   }
   do_test without_rowid3-14.2.1.1 {
     test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t2 t3