mirror of https://github.com/sqlite/sqlite
When running a CREATE TABLE AS, make the initial temporary sqlite_master entry
for the new table a real record rather than a NULL, in case the query after the AS actually tries to read the sqlite_master table. Fix for ticket [acd12990885d9276]. FossilOrigin-Name: 4a18d8bd4cc66eb08c6198cdf6e14f1bce0ec05a
This commit is contained in:
parent
0c6dfaa34a
commit
3c03afd3f5
14
manifest
14
manifest
|
@ -1,5 +1,5 @@
|
|||
C Remove\san\sunused\slocal\svariable\sfrom\sLemon.
|
||||
D 2015-09-08T21:16:46.221
|
||||
C When\srunning\sa\sCREATE\sTABLE\sAS,\smake\sthe\sinitial\stemporary\ssqlite_master\sentry\s\nfor\sthe\snew\stable\sa\sreal\srecord\srather\sthan\sa\sNULL,\sin\scase\sthe\squery\safter\s\nthe\sAS\sactually\stries\sto\sread\sthe\ssqlite_master\stable.\nFix\sfor\sticket\s[acd12990885d9276].
|
||||
D 2015-09-09T13:28:06.029
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
|
@ -284,7 +284,7 @@ F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
|||
F src/btree.c 4084d9eed2817331f6e6a82230ba30e448cad497
|
||||
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
|
||||
F src/btreeInt.h 8177c9ab90d772d6d2c6c517e05bed774b7c92c0
|
||||
F src/build.c ba9e1529730407cdf491480745716d6fbdc28cd3
|
||||
F src/build.c f81380bc4d5d239c18b42982a9866a94489fd444
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
F src/complete.c addcd8160b081131005d5bc2d34adf20c1c5c92f
|
||||
F src/ctime.c 5a0b735dc95604766f5dac73973658eef782ee8b
|
||||
|
@ -1039,7 +1039,7 @@ F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
|
|||
F test/syscall.test d2fdaad713f103ac611fe7ef9b724c7b69f8149c
|
||||
F test/sysfault.test fa776e60bf46bdd3ae69f0b73e46ee3977a58ae6
|
||||
F test/tabfunc01.test fa9d8dfc75747019e0be98d3b6ac68d18632d328
|
||||
F test/table.test 33bf0d1fd07f304582695184b8e6feb017303816
|
||||
F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f
|
||||
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
|
||||
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
|
||||
F test/tclsqlite.test 7fb866443c7deceed22b63948ccd6f76b52ad054
|
||||
|
@ -1383,7 +1383,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 6beb512c7a3c3649b56f0df1ca77855535a87ba7
|
||||
R 0ee50599e53bafcea0ab0d2587bdc748
|
||||
P fe9ffe5eed7d376f3f08c78c1ce5514c886f3479
|
||||
R 3da43b6baf65219c2aa2e7ef155b204b
|
||||
U drh
|
||||
Z b332ec0feed7e0dc71dd5e410ae1a5f1
|
||||
Z 28f0a6c435a4256f78d56b3bdcebab87
|
||||
|
|
|
@ -1 +1 @@
|
|||
fe9ffe5eed7d376f3f08c78c1ce5514c886f3479
|
||||
4a18d8bd4cc66eb08c6198cdf6e14f1bce0ec05a
|
|
@ -986,6 +986,8 @@ void sqlite3StartTable(
|
|||
int j1;
|
||||
int fileFormat;
|
||||
int reg1, reg2, reg3;
|
||||
/* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */
|
||||
static const char nullRow[] = { 6, 0, 0, 0, 0, 0 };
|
||||
sqlite3BeginWriteOperation(pParse, 1, iDb);
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
@ -1030,7 +1032,7 @@ void sqlite3StartTable(
|
|||
}
|
||||
sqlite3OpenMasterTable(pParse, iDb);
|
||||
sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);
|
||||
sqlite3VdbeAddOp2(v, OP_Null, 0, reg3);
|
||||
sqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC);
|
||||
sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1);
|
||||
sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
|
||||
sqlite3VdbeAddOp0(v, OP_Close);
|
||||
|
|
|
@ -823,5 +823,17 @@ do_execsql_test table-18.2 {
|
|||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
# 2015-09-09
|
||||
# Ticket [https://www.sqlite.org/src/info/acd12990885d9276]
|
||||
# "CREATE TABLE ... AS SELECT ... FROM sqlite_master" fails because the row
|
||||
# in the sqlite_master table for the next table is initially populated
|
||||
# with a NULL instead of a record created by OP_Record.
|
||||
#
|
||||
do_execsql_test table-19.1 {
|
||||
CREATE TABLE t19 AS SELECT * FROM sqlite_master;
|
||||
SELECT name FROM t19 ORDER BY name;
|
||||
} {{} savepoint t10 t11 t12 t13 t16 t2 t3 t3\"xyz t4\"abc t7 t8 t9 tablet8 test1 weird}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
|
Loading…
Reference in New Issue