First proposed fix for the ALTER TABLE problem described by ticket

[b41031ea2b5372378cb3d2d]

FossilOrigin-Name: 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056
This commit is contained in:
drh 2018-09-16 23:27:37 +00:00
parent 86f3492650
commit 95f78d98b9
4 changed files with 33 additions and 10 deletions

View File

@ -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

View File

@ -1 +1 @@
2df2cf4f179dd88fb2530dfd338f344ac48dd052ef954dc95a136884523f7aee
05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056

View File

@ -240,7 +240,9 @@ static int lookupName(
for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; 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;

View File

@ -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