Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN. Fix for [c88f3036a2]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
354a4db5cb769c6aed386f43ee26d7e4 |
User & Date: | dan 2021-04-18 05:30:39.861 |
Original Comment: | Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN. |
Context
2021-04-19
| ||
15:05 | In the query flattener, avoid invalidating an expression if an OOM occurs. This prevents problems in higher-level routines that might not check for the OOM after processing a subquery. dbsqlfuzz fb70fa8602421f87673e0670b0712ff2b5240ea0 (check-in: d564d8882e user: drh tags: trunk) | |
2021-04-18
| ||
06:03 | Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN. Fix for [c88f3036a2]. (check-in: 11c368f20a user: dan tags: branch-3.35) | |
05:30 | Ensure that all records are updated by setting the OPFLAG_SAVEPOSITION flag when updating records as part of ALTER TABLE DROP COLUMN. Fix for [c88f3036a2]. (check-in: 354a4db5cb user: dan tags: trunk) | |
2021-04-17
| ||
20:13 | Remove a couple of NEVER() macros from the code for walking window lists. (check-in: 4ec9ef4bcd user: dan tags: trunk) | |
Changes
Changes to src/alter.c.
︙ | ︙ | |||
2115 2116 2117 2118 2119 2120 2121 | int iPos = sqlite3TableColumnToIndex(pPk, i); int iColPos = sqlite3TableColumnToIndex(pPk, iCol); if( iPos<pPk->nKeyCol ) continue; regOut = reg+1+iPos-(iPos>iColPos); }else{ regOut = reg+1+nField; } | > > > | > > | 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 | int iPos = sqlite3TableColumnToIndex(pPk, i); int iColPos = sqlite3TableColumnToIndex(pPk, iCol); if( iPos<pPk->nKeyCol ) continue; regOut = reg+1+iPos-(iPos>iColPos); }else{ regOut = reg+1+nField; } if( i==pTab->iPKey ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regOut); }else{ sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut); } nField++; } } sqlite3VdbeAddOp3(v, OP_MakeRecord, reg+1, nField, regRec); if( pPk ){ sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iCur, regRec, reg+1, pPk->nKeyCol); }else{ sqlite3VdbeAddOp3(v, OP_Insert, iCur, regRec, reg); } sqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); sqlite3VdbeAddOp2(v, OP_Next, iCur, addr+1); VdbeCoverage(v); sqlite3VdbeJumpHere(v, addr); } exit_drop_column: sqlite3DbFree(db, zCol); |
︙ | ︙ |
Changes to test/alterdropcol.test.
︙ | ︙ | |||
304 305 306 307 308 309 310 311 312 313 314 | sqlite3 db test.db do_execsql_test 8.1 { ALTER TABLE t1 DROP COLUMN b; } do_execsql_test 8.2 { SELECT sql FROM sqlite_schema; } {{CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT)}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | sqlite3 db test.db do_execsql_test 8.1 { ALTER TABLE t1 DROP COLUMN b; } do_execsql_test 8.2 { SELECT sql FROM sqlite_schema; } {{CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT)}} #------------------------------------------------------------------------- foreach {tn wo} { 1 {} 2 {WITHOUT ROWID} } { reset_db do_execsql_test 9.$tn.0 " CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c) $wo; " do_execsql_test 9.$tn.1 { WITH s(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<50000 ) INSERT INTO t1(a, b, c) SELECT i, 123, 456 FROM s; } do_execsql_test 9.$tn.2 { ALTER TABLE t1 DROP COLUMN b; } do_execsql_test 9.$tn.3 { SELECT count(*), c FROM t1 GROUP BY c; } {50000 456} } finish_test |