Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure that the tbl_name column in the sqlite_temp_master table is updated correctly as part of a RENAME TABLE operation. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | alter-table-rename-column |
Files: | files | file ages | folders |
SHA3-256: |
ffecfca511718e39e0003b380d511375 |
User & Date: | dan 2018-09-06 16:01:37.037 |
Context
2018-09-06
| ||
16:17 | Merge latest trunk changes into this branch. (Closed-Leaf check-in: 8a28a326d7 user: dan tags: alter-table-rename-column) | |
16:01 | Ensure that the tbl_name column in the sqlite_temp_master table is updated correctly as part of a RENAME TABLE operation. (check-in: ffecfca511 user: dan tags: alter-table-rename-column) | |
2018-09-05
| ||
17:52 | Merge latest trunk changes into this branch. (check-in: 6f4f707f9c user: dan tags: alter-table-rename-column) | |
Changes
Changes to src/alter.c.
︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + - + | */ void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ sqlite3NestedParse(pParse, "SELECT 1 " "FROM \"%w\".%s " "WHERE name NOT LIKE 'sqlite_%%'" " AND sql NOT LIKE 'create virtual%%'" |
︙ | |||
229 230 231 232 233 234 235 | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - + + + - + | ** edit view and trigger definitions within the temp database ** as required. */ if( iDb!=1 ){ sqlite3NestedParse(pParse, "UPDATE sqlite_temp_master SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), " "tbl_name = " |
︙ | |||
1485 1486 1487 1488 1489 1490 1491 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | - + + + + + + + | } /* ** An SQL user function that checks that there are no parse or symbol ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. ** After an ALTER TABLE .. RENAME operation is performed and the schema ** reloaded, this function is called on each SQL statement in the schema |
︙ | |||
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 | 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | + + + + + | sNC.pParse = &sParse; sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; } else if( sParse.pNewTrigger ){ rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); if( rc==SQLITE_OK ){ int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); int i2 = sqlite3FindDbName(db, zDb); if( i1==i2 ) sqlite3_result_int(context, 1); } } } if( rc!=SQLITE_OK ){ renameColumnParseError(context, 1, argv[2], argv[3], &sParse); } renameParseCleanup(&sParse); |
︙ |
Changes to test/altertab.test.
︙ | |||
321 322 323 324 325 326 327 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + | } do_execsql_test 10.2 { SELECT * FROM ggg; } {a b c} } #------------------------------------------------------------------------- reset_db forcedelete test.db2 db func trigger trigger set ::trigger [list] proc trigger {args} { lappend ::trigger $args } do_execsql_test 11.0 { ATTACH 'test.db2' AS aux; CREATE TABLE aux.t1(a, b, c); CREATE TABLE main.t1(a, b, c); CREATE TEMP TRIGGER tr AFTER INSERT ON aux.t1 BEGIN SELECT trigger(new.a, new.b, new.c); END; } |