Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a bug causing an "malformed database schema error" error if a temp table with the same name as an existing table that has at least one temp trigger attached to it is created. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
56dca4a65c3b14123272fa0cc5c15530 |
User & Date: | dan 2013-10-19 15:07:49.621 |
Context
2013-10-19
| ||
16:51 | Improved header comment with better instructions on the vfslog.c extension. (check-in: 4bd592c8f0 user: drh tags: trunk) | |
15:07 | Fix a bug causing an "malformed database schema error" error if a temp table with the same name as an existing table that has at least one temp trigger attached to it is created. (check-in: 56dca4a65c user: dan tags: trunk) | |
2013-10-18
| ||
20:03 | Add the SQLITE_FCNTL_TRACE file control and generate it for OP_Trace when compiled with SQLITE_USE_FCNTL_TRACE. Update vfslog.c to make use of the new file control. Also update vfslog.c to log UNLOCK events before the fact, rather than afterwards. (check-in: e801f35a96 user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
1710 1711 1712 1713 1714 1715 1716 | ); } } #endif /* Reparse everything to update our internal data structures */ sqlite3VdbeAddParseSchemaOp(v, iDb, | | | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | ); } } #endif /* Reparse everything to update our internal data structures */ sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName)); } /* Add the table to the in-memory representation of the database. */ if( db->init.busy ){ Table *pOld; |
︙ | ︙ |
Changes to test/auth2.test.
︙ | ︙ | |||
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | SQLITE_UPDATE sqlite_master rootpage main {} SQLITE_UPDATE sqlite_master sql main {} SQLITE_READ sqlite_master ROWID main {} SQLITE_READ sqlite_master name main {} SQLITE_READ sqlite_master rootpage main {} SQLITE_READ sqlite_master sql main {} SQLITE_READ sqlite_master tbl_name main {} SQLITE_READ sqlite_master ROWID main {} } do_test auth2-2.2 { set ::authargs {} db eval { CREATE VIEW v2 AS SELECT x+y AS a, y+z AS b from t2; } set ::authargs } {SQLITE_INSERT sqlite_master {} main {} SQLITE_CREATE_VIEW v2 {} main {} SQLITE_UPDATE sqlite_master type main {} SQLITE_UPDATE sqlite_master name main {} SQLITE_UPDATE sqlite_master tbl_name main {} SQLITE_UPDATE sqlite_master rootpage main {} SQLITE_UPDATE sqlite_master sql main {} SQLITE_READ sqlite_master ROWID main {} SQLITE_READ sqlite_master name main {} SQLITE_READ sqlite_master rootpage main {} SQLITE_READ sqlite_master sql main {} SQLITE_READ sqlite_master tbl_name main {} SQLITE_READ sqlite_master ROWID main {} } do_test auth2-2.3 { set ::authargs {} db eval { SELECT a, b FROM v2; } | > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | SQLITE_UPDATE sqlite_master rootpage main {} SQLITE_UPDATE sqlite_master sql main {} SQLITE_READ sqlite_master ROWID main {} SQLITE_READ sqlite_master name main {} SQLITE_READ sqlite_master rootpage main {} SQLITE_READ sqlite_master sql main {} SQLITE_READ sqlite_master tbl_name main {} SQLITE_READ sqlite_master type main {} SQLITE_READ sqlite_master ROWID main {} } do_test auth2-2.2 { set ::authargs {} db eval { CREATE VIEW v2 AS SELECT x+y AS a, y+z AS b from t2; } set ::authargs } {SQLITE_INSERT sqlite_master {} main {} SQLITE_CREATE_VIEW v2 {} main {} SQLITE_UPDATE sqlite_master type main {} SQLITE_UPDATE sqlite_master name main {} SQLITE_UPDATE sqlite_master tbl_name main {} SQLITE_UPDATE sqlite_master rootpage main {} SQLITE_UPDATE sqlite_master sql main {} SQLITE_READ sqlite_master ROWID main {} SQLITE_READ sqlite_master name main {} SQLITE_READ sqlite_master rootpage main {} SQLITE_READ sqlite_master sql main {} SQLITE_READ sqlite_master tbl_name main {} SQLITE_READ sqlite_master type main {} SQLITE_READ sqlite_master ROWID main {} } do_test auth2-2.3 { set ::authargs {} db eval { SELECT a, b FROM v2; } |
︙ | ︙ |
Changes to test/temptrigger.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # #*********************************************************************** # # $Id: temptrigger.test,v 1.3 2009/04/15 13:07:19 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable {!trigger || !shared_cache} { finish_test ; return } # Test cases: # # temptrigger-1.*: Shared cache problem. # temptrigger-2.*: A similar shared cache problem. | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # # $Id: temptrigger.test,v 1.3 2009/04/15 13:07:19 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix temptrigger ifcapable {!trigger || !shared_cache} { finish_test ; return } # Test cases: # # temptrigger-1.*: Shared cache problem. # temptrigger-2.*: A similar shared cache problem. |
︙ | ︙ | |||
197 198 199 200 201 202 203 204 | # assert if executed. #execsql { DROP TRIGGER tr2 } } {} catch { db close } catch { db2 close } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | # assert if executed. #execsql { DROP TRIGGER tr2 } } {} catch { db close } catch { db2 close } #------------------------------------------------------------------------- # Test that creating a temp table after a temp trigger on the same name # has been created is an error. # reset_db do_execsql_test 4.0 { CREATE TABLE t1(x); CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END; } do_execsql_test 4.1 { CREATE TEMP TABLE t1(x); } #------------------------------------------------------------------------- # Test that no harm is done if the table a temp trigger is attached to is # deleted by an external connection. # reset_db do_execsql_test 5.0 { CREATE TABLE t1(x); CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END; } do_test 5.1 { sqlite3 db2 test.db execsql { DROP TABLE t1 } db2 } {} do_execsql_test 5.2 { SELECT * FROM sqlite_master; SELECT * FROM sqlite_temp_master; } { trigger tr1 t1 0 {CREATE TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT 1,2,3; END} } db2 close #------------------------------------------------------------------------- # Check that if a second connection creates a table in an attached database # with the same name as a table in the main database that has a temp # trigger attached to it nothing goes awry. # reset_db forcedelete test.db2 do_execsql_test 6.0 { CREATE TABLE t1(x); CREATE TEMP TRIGGER tr1 BEFORE INSERT ON t1 BEGIN SELECT raise(ABORT, 'error'); END; ATTACH 'test.db2' AS aux; } do_test 6.1 { sqlite3 db2 test.db2 execsql { CREATE TABLE t1(a, b, c); } db2 } {} do_execsql_test 6.2 { SELECT * FROM aux.sqlite_master; INSERT INTO aux.t1 VALUES(1,2,3); } { table t1 t1 2 {CREATE TABLE t1(a, b, c)} } do_catchsql_test 6.3 { INSERT INTO main.t1 VALUES(1); } {1 error} db2 close finish_test |