Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tkt-b41031ea Excluding Merge-Ins
This is equivalent to a diff from 2df2cf4f to a7b572ca
2018-09-17
| ||
14:13 | Fix a false-positive in the post-ALTER-TABLE schema verification logic that prevents ALTER TABLE from working if the table being altered has a trigger that references any column of a virtual table. Ticket [b41031ea2b537237]. (check-in: 84105ea4 user: drh tags: trunk) | |
13:55 | Restore an assert() that was present on trunk. (Closed-Leaf check-in: a7b572ca user: drh tags: tkt-b41031ea) | |
13:38 | Minor modification to the fix on this branch to avoid adding extra conditional compilation macros. (check-in: 4d8be404 user: dan tags: tkt-b41031ea) | |
12:49 | Fix missing space in 'configure.ac' reported on the mailing list. (check-in: 96b00a3c user: mistachkin tags: trunk) | |
2018-09-16
| ||
23:27 | First proposed fix for the ALTER TABLE problem described by ticket [b41031ea2b5372378cb3d2d] (check-in: 05a9d129 user: drh tags: tkt-b41031ea) | |
18:23 | Remove an unreachable branch from the index-on-expression optimization. (check-in: 2df2cf4f user: drh tags: trunk) | |
16:34 | Fix a memory leak in the explain extension. (check-in: d0c92b04 user: drh tags: trunk) | |
Changes to src/alter.c.
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | sqlite3SelectPrep(pParse, pStep->pSelect, &sNC); if( pParse->nErr ) rc = pParse->rc; } if( rc==SQLITE_OK && pStep->zTarget ){ Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); if( pTarget==0 ){ rc = SQLITE_ERROR; | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | sqlite3SelectPrep(pParse, pStep->pSelect, &sNC); if( pParse->nErr ) rc = pParse->rc; } if( rc==SQLITE_OK && pStep->zTarget ){ Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); if( pTarget==0 ){ rc = SQLITE_ERROR; }else if( SQLITE_OK==(rc = sqlite3ViewGetColumnNames(pParse, pTarget)) ){ SrcList sSrc; memset(&sSrc, 0, sizeof(sSrc)); sSrc.nSrc = 1; sSrc.a[0].zName = pStep->zTarget; sSrc.a[0].pTab = pTarget; sNC.pSrcList = &sSrc; if( pStep->pWhere ){ |
︙ | ︙ |
Changes to src/build.c.
︙ | ︙ | |||
2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 | ** to the elements of the FROM clause. But we do not want these changes ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ assert( pTable->pSelect ); pSel = sqlite3SelectDup(db, pTable->pSelect, 0); if( pSel ){ n = pParse->nTab; sqlite3SrcListAssignCursors(pParse, pSel->pSrc); pTable->nCol = -1; db->lookaside.bDisable++; #ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; db->xAuth = 0; | > > > > | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 | ** to the elements of the FROM clause. But we do not want these changes ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ 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; db->lookaside.bDisable++; #ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; db->xAuth = 0; |
︙ | ︙ | |||
2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 | }else{ pTable->nCol = 0; nErr++; } sqlite3DeleteTable(db, pSelTab); sqlite3SelectDelete(db, pSel); db->lookaside.bDisable--; } else { nErr++; } pTable->pSchema->schemaFlags |= DB_UnresetViews; if( db->mallocFailed ){ sqlite3DeleteColumnNames(db, pTable); pTable->aCol = 0; | > > > | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | }else{ pTable->nCol = 0; nErr++; } sqlite3DeleteTable(db, pSelTab); sqlite3SelectDelete(db, pSel); db->lookaside.bDisable--; #ifndef SQLITE_OMIT_ALTERTABLE pParse->eParseMode = eParseMode; #endif } else { nErr++; } pTable->pSchema->schemaFlags |= DB_UnresetViews; if( db->mallocFailed ){ sqlite3DeleteColumnNames(db, pTable); pTable->aCol = 0; |
︙ | ︙ |
Changes to test/alter.test.
︙ | ︙ | |||
871 872 873 874 875 876 877 | SELECT * FROM t16a ORDER BY a; } {abc 1.25 99 xyzzy cba 5.5 98 fizzle} do_execsql_test alter-16.2 { ALTER TABLE t16a RENAME TO t16a_rn; SELECT * FROM t16a_rn ORDER BY a; } {abc 1.25 99 xyzzy cba 5.5 98 fizzle} | > > > > > | > > > > > > > > > > > | > > | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | SELECT * FROM t16a ORDER BY a; } {abc 1.25 99 xyzzy cba 5.5 98 fizzle} do_execsql_test alter-16.2 { ALTER TABLE t16a RENAME TO t16a_rn; SELECT * FROM t16a_rn ORDER BY a; } {abc 1.25 99 xyzzy cba 5.5 98 fizzle} # 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 |
Changes to test/altertab.test.
︙ | ︙ | |||
406 407 408 409 410 411 412 413 414 415 | do_execsql_test 13.1 { INSERT INTO t1 VALUES(1, 2); } do_catchsql_test 13.2 { ALTER TABLE t2 RENAME b TO y; } {1 {error in trigger tr1 after rename: ambiguous column name: y}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | do_execsql_test 13.1 { INSERT INTO t1 VALUES(1, 2); } 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 |