/ Changes On Branch mistake
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch mistake Excluding Merge-Ins

This is equivalent to a diff from 4d21640c to 4878c9ef

2023-02-07
15:57
Avoid loading (and then discarding) schemas for all attached databases within an ATTACH command. This is inefficient for connections using shared-schema. (check-in: 50174e82 user: dan tags: reuse-schema)
15:38
Avoid loading (and then discarding) schemas for all attached databases within an ATTACH command. This is inefficient for connections using shared-schema. (Closed-Leaf check-in: 4878c9ef user: dan tags: mistake)
15:29
Merge latest trunk changes into this branch. (check-in: 4d21640c user: dan tags: reuse-schema)
2023-02-06
21:20
Roll back part of [c54f29d8] which attempted to use symbols which that worker does not have access to. (check-in: 90b12211 user: stephan tags: trunk)
2023-01-12
19:43
Merge latest trunk changes, including fixes for RBU pass-through mode, with this branch. (check-in: deb26d03 user: dan tags: reuse-schema)

Changes to src/attach.c.

351
352
353
354
355
356
357

358

359
360
361
362
363
364
365
){
  int rc;
  NameContext sName;
  Vdbe *v;
  sqlite3* db = pParse->db;
  int regArgs;


  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto attach_end;


  if( pParse->nErr ) goto attach_end;
  memset(&sName, 0, sizeof(NameContext));
  sName.pParse = pParse;

  if( 
      SQLITE_OK!=resolveAttachExpr(&sName, pFilename) ||







>
|
>







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
){
  int rc;
  NameContext sName;
  Vdbe *v;
  sqlite3* db = pParse->db;
  int regArgs;

  if( db->mDbFlags & DBFLAG_EncodingFixed ){
    if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto attach_end;
  }

  if( pParse->nErr ) goto attach_end;
  memset(&sName, 0, sizeof(NameContext));
  sName.pParse = pParse;

  if( 
      SQLITE_OK!=resolveAttachExpr(&sName, pFilename) ||

Changes to test/reuse2.test.

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
    ATTACH 'test.db4' AS db4;
    ATTACH 'test.db5' AS db5;
  } db2
} {}
do_execsql_test 4.1.2 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {}
do_execsql_test -db db2 4.1.3 {
  SELECT * FROM db3.x1
}
do_execsql_test 4.1.4 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=1 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.5 {
  SELECT * FROM db2.x1
}
do_execsql_test 4.1.6 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=2 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.7 {
  SELECT * FROM x1
}
do_execsql_test 4.1.8 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=6 nschema=1 ndelete=0}

do_test 4.2.1 {
  catchsql { SELECT * FROM abc } db2
} {1 {no such table: abc}}
do_execsql_test 4.2.2 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;







|






|






|






|







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
    ATTACH 'test.db4' AS db4;
    ATTACH 'test.db5' AS db5;
  } db2
} {}
do_execsql_test 4.1.2 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=1 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.3 {
  SELECT * FROM db3.x1
}
do_execsql_test 4.1.4 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=2 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.5 {
  SELECT * FROM db2.x1
}
do_execsql_test 4.1.6 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=3 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.7 {
  SELECT * FROM x1
}
do_execsql_test 4.1.8 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;
} {nref=3 nschema=1 ndelete=0}

do_test 4.2.1 {
  catchsql { SELECT * FROM abc } db2
} {1 {no such table: abc}}
do_execsql_test 4.2.2 {
  SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
  FROM schemapool;

Changes to test/reuse3.test.

330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
    execsql "ATTACH '$base' AS $nm"
  }
} {}

do_test 6.2 {
  set N1 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  set N2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  expr ($N1==0 && $N2==0)
} {1}

do_test 6.3 {
  execsql { SELECT * FROM main.t1 }
  set N1 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  set N2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  expr {$N1>0 && $N2>0 && $N1==$N2}







|







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
    execsql "ATTACH '$base' AS $nm"
  }
} {}

do_test 6.2 {
  set N1 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  set N2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  expr {$N1>0 && $N2>0 && $N1==$N2}
} {1}

do_test 6.3 {
  execsql { SELECT * FROM main.t1 }
  set N1 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  set N2 [lindex [sqlite3_db_status db SCHEMA_USED 0] 1]
  expr {$N1>0 && $N2>0 && $N1==$N2}