Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4a18d8bd4cc66eb08c6198cdf6e14f1b |
User & Date: | drh 2015-09-09 13:28:06.029 |
Context
2015-09-09
| ||
17:17 | Fix harmless compiler warnings in FTS5. (check-in: 2cdb18778f user: mistachkin tags: trunk) | |
13:28 | 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]. (check-in: 4a18d8bd4c user: drh tags: trunk) | |
2015-09-08
| ||
21:16 | Remove an unused local variable from Lemon. (check-in: fe9ffe5eed user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
982 983 984 985 986 987 988 989 990 991 992 993 994 995 | ** indices. Hence, the record number for the table must be allocated ** now. */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ int j1; int fileFormat; int reg1, reg2, reg3; sqlite3BeginWriteOperation(pParse, 1, iDb); #ifndef SQLITE_OMIT_VIRTUALTABLE if( isVirtual ){ sqlite3VdbeAddOp0(v, OP_VBegin); } #endif | > > | 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | ** indices. Hence, the record number for the table must be allocated ** now. */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ 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 if( isVirtual ){ sqlite3VdbeAddOp0(v, OP_VBegin); } #endif |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | }else #endif { pParse->addrCrTab = sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2); } sqlite3OpenMasterTable(pParse, iDb); sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); | | | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | }else #endif { pParse->addrCrTab = sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2); } sqlite3OpenMasterTable(pParse, iDb); sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); 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); } /* Normal (non-error) return. */ return; |
︙ | ︙ |
Changes to test/table.test.
︙ | ︙ | |||
818 819 820 821 822 823 824 825 826 827 | BEGIN; CREATE TABLE t1 AS SELECT zeroblob(2e20); } {1 {string or blob too big}} do_execsql_test table-18.2 { COMMIT; PRAGMA integrity_check; } {ok} finish_test | > > > > > > > > > > > > | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | BEGIN; CREATE TABLE t1 AS SELECT zeroblob(2e20); } {1 {string or blob too big}} do_execsql_test table-18.2 { COMMIT; 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 |