From 95f78d98b968781e4b08b9f6063793aa33193890 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 16 Sep 2018 23:27:37 +0000 Subject: [PATCH 1/5] First proposed fix for the ALTER TABLE problem described by ticket [b41031ea2b5372378cb3d2d] FossilOrigin-Name: 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056 --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/resolve.c | 4 +++- test/alter.test | 20 +++++++++++++++++++- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 7dda1dfbb7..03f188a18e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunreachable\sbranch\sfrom\sthe\sindex-on-expression\soptimization. -D 2018-09-16T18:23:48.660 +C First\sproposed\sfix\sfor\sthe\sALTER\sTABLE\sproblem\sdescribed\sby\sticket\n[b41031ea2b5372378cb3d2d] +D 2018-09-16T23:27:37.486 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -500,7 +500,7 @@ F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324 F src/prepare.c f8e260d940a0e08494c0f30744521b2f832d7263eca9d02b050cea0ba144b097 F src/printf.c 0f1177cf1dd4d7827bf64d840768514ec76409abecaca9e8b577dbd065150381 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 -F src/resolve.c 352c6af1a99441206ff62a6f7429dbf537827f42c428639695220b9c8639e33b +F src/resolve.c c1bc3a26460721d2cba0797f59879fd53bd6c841afa00b8b31642c0dfd1fdf3c F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/select.c ed6192ddd09a97169cb1c6d732b26c0f647b72d5fa8ca401c7ee1180fbbe521a F src/shell.c.in 6e0aad854be738a5d0368940459399be211e9ac43aebe92bb9ed46cfe38d0e1f @@ -599,7 +599,7 @@ F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 18b00de006597e960a6b27ccec51474ac66cf1070a87c1933e5694dc02190ef1 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 2ecb8bbd52416642e41c9081182a8df05d42c75637afd4488aace78cc4b69e13 -F test/alter.test cf28c2f35253d3395cf16334fb9dde1d8c4b035cb7c89204353ee1f47feaec1b +F test/alter.test 99e72759d48d6531ac2a9f346b4a9b5fe8f89c67a0fa5e916a3990d3b1fe9d09 F test/alter2.test 7ea05c7d92ac99349a802ef7ada17294dd647060 F test/alter3.test 4d79934d812eaeacc6f22781a080f8cfe012fdc3 F test/alter4.test 7e93a21fe131e1dfeb317e90056856f96b10381fc7fe3a05e765569a23400433 @@ -1766,7 +1766,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d0c92b047a5355726aea87f38038e5bda3adf6137492919be94bd29bb847eddb -R 15742f49a8284f0d50788336ea1ceec8 +P 2df2cf4f179dd88fb2530dfd338f344ac48dd052ef954dc95a136884523f7aee +R fe632daa0f368e2d5f1d4be59c87d7ab +T *branch * tkt-b41031ea +T *sym-tkt-b41031ea * +T -sym-trunk * U drh -Z 742041dc2da982886153478b782feb91 +Z 491184a3fb91134029b6eaff416a99f5 diff --git a/manifest.uuid b/manifest.uuid index 3ce9051c72..4858388b5f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2df2cf4f179dd88fb2530dfd338f344ac48dd052ef954dc95a136884523f7aee \ No newline at end of file +05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056 \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index 9fb4d4c63f..017b026de3 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -240,7 +240,9 @@ static int lookupName( for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){ pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); - assert( pTab->nCol>0 ); + if( pTab->nCol==0 ){ + if( sqlite3ViewGetColumnNames(pNC->pParse, pTab) ) return WRC_Abort; + } if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ int hit = 0; pEList = pItem->pSelect->pEList; diff --git a/test/alter.test b/test/alter.test index 520c54689e..807a8f0171 100644 --- a/test/alter.test +++ b/test/alter.test @@ -875,5 +875,23 @@ do_execsql_test alter-16.2 { SELECT * FROM t16a_rn ORDER BY a; } {abc 1.25 99 xyzzy cba 5.5 98 fizzle} -finish_test +# 2018-09-16 ticket b41031ea2b5372378cb3d2d43cf9fe2a4a5c2510 +# +ifcapable rtree { + db close + sqlite3 db :memory: + do_execsql_test alter-17.100 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); + CREATE VIRTUAL TABLE t2 USING rtree(id,x0,x1); + INSERT INTO t1 VALUES(1,'apple'),(2,'fig'),(3,'pear'); + INSERT INTO t2 VALUES(1,1.0,2.0),(2,2.0,3.0),(3,1.5,3.5); + CREATE TRIGGER r1 AFTER UPDATE ON t1 BEGIN + DELETE FROM t2 WHERE id = OLD.a; + END; + ALTER TABLE t1 RENAME TO t3; + UPDATE t3 SET b='peach' WHERE a=2; + SELECT * FROM t2 ORDER BY 1; + } {1 1.0 2.0 3 1.5 3.5} +} +finish_test From e68fe9665abfe477c1b2ebcae3554cd9a0352267 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 17 Sep 2018 00:15:21 +0000 Subject: [PATCH 2/5] Add assert()s to the new code in the previous check-in. FossilOrigin-Name: b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/resolve.c | 5 ++++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 03f188a18e..6fba155647 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C First\sproposed\sfix\sfor\sthe\sALTER\sTABLE\sproblem\sdescribed\sby\sticket\n[b41031ea2b5372378cb3d2d] -D 2018-09-16T23:27:37.486 +C Add\sassert()s\sto\sthe\snew\scode\sin\sthe\sprevious\scheck-in. +D 2018-09-17T00:15:21.614 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -500,7 +500,7 @@ F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324 F src/prepare.c f8e260d940a0e08494c0f30744521b2f832d7263eca9d02b050cea0ba144b097 F src/printf.c 0f1177cf1dd4d7827bf64d840768514ec76409abecaca9e8b577dbd065150381 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 -F src/resolve.c c1bc3a26460721d2cba0797f59879fd53bd6c841afa00b8b31642c0dfd1fdf3c +F src/resolve.c c32f4c9473207e0434489582161867e92548128492112e756d5b0dd248567bfe F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/select.c ed6192ddd09a97169cb1c6d732b26c0f647b72d5fa8ca401c7ee1180fbbe521a F src/shell.c.in 6e0aad854be738a5d0368940459399be211e9ac43aebe92bb9ed46cfe38d0e1f @@ -1766,10 +1766,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 2df2cf4f179dd88fb2530dfd338f344ac48dd052ef954dc95a136884523f7aee -R fe632daa0f368e2d5f1d4be59c87d7ab -T *branch * tkt-b41031ea -T *sym-tkt-b41031ea * -T -sym-trunk * +P 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056 +R 06efc1c5b094a00f26fafeb2dea6c95e U drh -Z 491184a3fb91134029b6eaff416a99f5 +Z 392095af0ce931065bb28167458f689d diff --git a/manifest.uuid b/manifest.uuid index 4858388b5f..0422c97fde 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056 \ No newline at end of file +b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index 017b026de3..b10843ca09 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -241,7 +241,10 @@ static int lookupName( pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); if( pTab->nCol==0 ){ - if( sqlite3ViewGetColumnNames(pNC->pParse, pTab) ) return WRC_Abort; + assert( pParse->eParseMode==PARSE_MODE_RENAME_COLUMN + || pParse->eParseMode==PARSE_MODE_RENAME_TABLE ); + assert( pNC->pParse==pParse ); + if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; } if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ int hit = 0; From 0208337c16f99a56885ad4067712b76a75019040 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 17 Sep 2018 08:27:23 +0000 Subject: [PATCH 3/5] Add extra test for the fix on this branch. Also fix a pointer-compare-after-free problem that occurs in similar cases. FossilOrigin-Name: 1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca --- manifest | 16 +++++++-------- manifest.uuid | 2 +- src/build.c | 7 +++++++ test/altertab.test | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 6fba155647..de77e631f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sassert()s\sto\sthe\snew\scode\sin\sthe\sprevious\scheck-in. -D 2018-09-17T00:15:21.614 +C Add\sextra\stest\sfor\sthe\sfix\son\sthis\sbranch.\sAlso\sfix\sa\npointer-compare-after-free\sproblem\sthat\soccurs\sin\ssimilar\scases. +D 2018-09-17T08:27:23.927 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -446,7 +446,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6 F src/btree.c 3f5e1a03db871e627bf5da21092bf7434ecfc5c5980bbd7d45eba13341340173 F src/btree.h febb2e817be499570b7a2e32a9bbb4b607a9234f6b84bb9ae84916d4806e96f2 F src/btreeInt.h 620ab4c7235f43572cf3ac2ac8723cbdf68073be4d29da24897c7b77dda5fd96 -F src/build.c 90571aa2a9eb44e04291ffe9984c814883b9eb371f89898accec384520369597 +F src/build.c 3bdd61d7ecba6f40e7efead3ffb61b2e3bad87de73f407c288035937c9b33687 F src/callback.c 36caff1e7eb7deb58572d59c41cee8f064a11d00297616995c5050ea0cfc1288 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c b157b01081f92442f8b0218ddb93ddce8ebddad36dbddeecfdd771561dd4f387 @@ -607,7 +607,7 @@ F test/alterauth.test dc50064e3d57d60cf8708decefed15cfa154242f6d44069858d4c6c9b1 F test/altercol.test 53fb5e218c9296afc160f2c4fcbeaf42bd0604815d9b3896a7d2eec583ad8704 F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc F test/altermalloc2.test 0231398534c494401a70a1d06a63d7849cb5b317fcc14228cbdb53039eba7eae -F test/altertab.test fe08624ef1554b85c943ac6289f591e2e9984704a6b35b94613af42cc92ba474 +F test/altertab.test 3b830144c18ae00abd2a27e3d2851c8bb1ee8fe655fa16d8a5971066dc71b58a F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f F test/analyze.test b3a9c67d00e1df7588a5b7be9a0292899f94fe8cac1f94a017277474ca2e59df F test/analyze3.test ff62d9029e6deb2c914490c6b00caf7fae47cc85cdc046e4a0d0a4d4b87c71d8 @@ -1766,7 +1766,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 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056 -R 06efc1c5b094a00f26fafeb2dea6c95e -U drh -Z 392095af0ce931065bb28167458f689d +P b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e +R fdc93ad4d417c5a17eda517310446c18 +U dan +Z 0a0cf7b3375e76f2b517ca3739e2db01 diff --git a/manifest.uuid b/manifest.uuid index 0422c97fde..8e6555a42b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e \ No newline at end of file +1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca \ No newline at end of file diff --git a/src/build.c b/src/build.c index cbdfafe090..65b9107118 100644 --- a/src/build.c +++ b/src/build.c @@ -2287,6 +2287,10 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ assert( pTable->pSelect ); pSel = sqlite3SelectDup(db, pTable->pSelect, 0); if( pSel ){ +#ifndef SQLITE_OMIT_ALTERTABLE + u8 eParseMode = pParse->eParseMode; + pParse->eParseMode = PARSE_MODE_NORMAL; +#endif n = pParse->nTab; sqlite3SrcListAssignCursors(pParse, pSel->pSrc); pTable->nCol = -1; @@ -2332,6 +2336,9 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ sqlite3DeleteTable(db, pSelTab); sqlite3SelectDelete(db, pSel); db->lookaside.bDisable--; +#ifndef SQLITE_OMIT_ALTERTABLE + pParse->eParseMode = eParseMode; +#endif } else { nErr++; } diff --git a/test/altertab.test b/test/altertab.test index a1ccccce2c..008ac1153d 100644 --- a/test/altertab.test +++ b/test/altertab.test @@ -411,5 +411,55 @@ do_catchsql_test 13.2 { ALTER TABLE t2 RENAME b TO y; } {1 {error in trigger tr1 after rename: ambiguous column name: y}} +#------------------------------------------------------------------------- +reset_db + +ifcapable rtree { + do_execsql_test 14.0 { + CREATE VIRTUAL TABLE rt USING rtree(id, minx, maxx, miny, maxy); + + CREATE TABLE "mytable" ( "fid" INTEGER PRIMARY KEY, "geom" BLOB); + + CREATE TRIGGER tr1 AFTER UPDATE OF "geom" ON "mytable" + WHEN OLD."fid" = NEW."fid" AND NEW."geom" IS NULL BEGIN + DELETE FROM rt WHERE id = OLD."fid"; + END; + + INSERT INTO mytable VALUES(1, X'abcd'); + } + + do_execsql_test 14.1 { + UPDATE mytable SET geom = X'1234' + } + + do_execsql_test 14.2 { + ALTER TABLE mytable RENAME TO mytable_renamed; + } + + do_execsql_test 14.3 { + CREATE TRIGGER tr2 AFTER INSERT ON mytable_renamed BEGIN + DELETE FROM rt WHERE id=(SELECT min(id) FROM rt); + END; + } + + do_execsql_test 14.4 { + ALTER TABLE mytable_renamed RENAME TO mytable2; + } +} + +reset_db +do_execsql_test 14.5 { + CREATE TABLE t1(a, b, c); + CREATE VIEW v1 AS SELECT * FROM t1; + CREATE TRIGGER xyz AFTER INSERT ON t1 BEGIN + SELECT a, b FROM v1; + END; +} +do_execsql_test 14.6 { + ALTER TABLE t1 RENAME TO tt1; +} + + + finish_test From de79e094bc1a804862e9766f70976fc4c4e97d3a Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 17 Sep 2018 13:38:45 +0000 Subject: [PATCH 4/5] Minor modification to the fix on this branch to avoid adding extra conditional compilation macros. FossilOrigin-Name: 4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/alter.c | 2 +- src/resolve.c | 6 ------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index de77e631f8..6a164c052c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextra\stest\sfor\sthe\sfix\son\sthis\sbranch.\sAlso\sfix\sa\npointer-compare-after-free\sproblem\sthat\soccurs\sin\ssimilar\scases. -D 2018-09-17T08:27:23.927 +C Minor\smodification\sto\sthe\sfix\son\sthis\sbranch\sto\savoid\sadding\sextra\sconditional\ncompilation\smacros. +D 2018-09-17T13:38:45.679 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -436,7 +436,7 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a -F src/alter.c 3800f24c922dfcab2e7a05b49123e2f9c903c26fccea71a5f9ac765e91949355 +F src/alter.c 2269dd2f37ba963fde4c51e9e83542f126c86a8e10357c17f48137c6bee5299b F src/analyze.c 3dc6b98cf007b005af89df165c966baaa48e8124f38c87b4d2b276fe7f0b9eb9 F src/attach.c 4bd5b92633671d3e8ce431153ebb1893b50335818423b5373f3f27969f79769a F src/auth.c 32a5bbe3b755169ab6c66311c5225a3cd4f75a46c041f7fb117e0cbb68055114 @@ -500,7 +500,7 @@ F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324 F src/prepare.c f8e260d940a0e08494c0f30744521b2f832d7263eca9d02b050cea0ba144b097 F src/printf.c 0f1177cf1dd4d7827bf64d840768514ec76409abecaca9e8b577dbd065150381 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 -F src/resolve.c c32f4c9473207e0434489582161867e92548128492112e756d5b0dd248567bfe +F src/resolve.c 4928a63b6abf6baa94efc5375004196fc8b704d4f036a4cce6e4f2e07f53c4b5 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/select.c ed6192ddd09a97169cb1c6d732b26c0f647b72d5fa8ca401c7ee1180fbbe521a F src/shell.c.in 6e0aad854be738a5d0368940459399be211e9ac43aebe92bb9ed46cfe38d0e1f @@ -1766,7 +1766,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 b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e -R fdc93ad4d417c5a17eda517310446c18 +P 1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca +R 6e72766cd421e67b35e1efbd11675502 U dan -Z 0a0cf7b3375e76f2b517ca3739e2db01 +Z 8ad44f59cac49311751e10cb991dd243 diff --git a/manifest.uuid b/manifest.uuid index 8e6555a42b..e3891237b7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca \ No newline at end of file +4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259 \ No newline at end of file diff --git a/src/alter.c b/src/alter.c index c33dfdfb85..08745ccee2 100644 --- a/src/alter.c +++ b/src/alter.c @@ -1076,7 +1076,7 @@ static int renameResolveTrigger(Parse *pParse, const char *zDb){ Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); if( pTarget==0 ){ rc = SQLITE_ERROR; - }else{ + }else if( SQLITE_OK==(rc = sqlite3ViewGetColumnNames(pParse, pTarget)) ){ SrcList sSrc; memset(&sSrc, 0, sizeof(sSrc)); sSrc.nSrc = 1; diff --git a/src/resolve.c b/src/resolve.c index b10843ca09..d5c4b42ada 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -240,12 +240,6 @@ static int lookupName( for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){ pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); - if( pTab->nCol==0 ){ - assert( pParse->eParseMode==PARSE_MODE_RENAME_COLUMN - || pParse->eParseMode==PARSE_MODE_RENAME_TABLE ); - assert( pNC->pParse==pParse ); - if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; - } if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ int hit = 0; pEList = pItem->pSelect->pEList; From e597c47545aa5db5cec581542c87e4108db99d56 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 17 Sep 2018 13:55:18 +0000 Subject: [PATCH 5/5] Restore an assert() that was present on trunk. FossilOrigin-Name: a7b572ca7867a95f49888dc95c0dc6d726afa9fea26283be147ba422639d1307 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/resolve.c | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 6a164c052c..dbf6ef6918 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Minor\smodification\sto\sthe\sfix\son\sthis\sbranch\sto\savoid\sadding\sextra\sconditional\ncompilation\smacros. -D 2018-09-17T13:38:45.679 +C Restore\san\sassert()\sthat\swas\spresent\son\strunk. +D 2018-09-17T13:55:18.143 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 01e95208a78b57d056131382c493c963518f36da4c42b12a97eb324401b3a334 @@ -500,7 +500,7 @@ F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324 F src/prepare.c f8e260d940a0e08494c0f30744521b2f832d7263eca9d02b050cea0ba144b097 F src/printf.c 0f1177cf1dd4d7827bf64d840768514ec76409abecaca9e8b577dbd065150381 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 -F src/resolve.c 4928a63b6abf6baa94efc5375004196fc8b704d4f036a4cce6e4f2e07f53c4b5 +F src/resolve.c 352c6af1a99441206ff62a6f7429dbf537827f42c428639695220b9c8639e33b F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/select.c ed6192ddd09a97169cb1c6d732b26c0f647b72d5fa8ca401c7ee1180fbbe521a F src/shell.c.in 6e0aad854be738a5d0368940459399be211e9ac43aebe92bb9ed46cfe38d0e1f @@ -1766,7 +1766,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 1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca -R 6e72766cd421e67b35e1efbd11675502 -U dan -Z 8ad44f59cac49311751e10cb991dd243 +P 4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259 +R b0210376dae3a6dbba696619be40dcd0 +U drh +Z 4dfef6ec80ce5527a940e761bd4de33e diff --git a/manifest.uuid b/manifest.uuid index e3891237b7..ca60fa17a4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259 \ No newline at end of file +a7b572ca7867a95f49888dc95c0dc6d726afa9fea26283be147ba422639d1307 \ No newline at end of file diff --git a/src/resolve.c b/src/resolve.c index d5c4b42ada..9fb4d4c63f 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -240,6 +240,7 @@ static int lookupName( for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){ pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); + assert( pTab->nCol>0 ); if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ int hit = 0; pEList = pItem->pSelect->pEList;