/ Check-in [fe49fb03]
Login

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

Overview
Comment:Enhance the "PRAGMA index_info" and "PRAGMA index_xinfo" statements so that they work on WITHOUT ROWID tables and provide information about the underlying index btree that implements the WITHOUT ROWID table.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | index-info-on-table
Files: files | file ages | folders
SHA1:fe49fb03133fec8bed51c2e2c1b6848ab9fc563e
User & Date: drh 2016-10-25 15:39:58
Context
2016-10-25
17:28
Merge recent trunk changes, and especially the PRAGMA index_info enhancement which is needed on this branch. check-in: c3570e46 user: drh tags: est_count_pragma
15:39
Enhance the "PRAGMA index_info" and "PRAGMA index_xinfo" statements so that they work on WITHOUT ROWID tables and provide information about the underlying index btree that implements the WITHOUT ROWID table. Leaf check-in: fe49fb03 user: drh tags: index-info-on-table
15:06
Add test case to demonstrate a "BEGIN EXCLUSIVE" command returning SQLITE_BUSY_SNAPSHOT. check-in: b1158564 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

1118
1119
1120
1121
1122
1123
1124




1125
1126
1127
1128
1129
1130
1131
  }
  break;

  case PragTyp_INDEX_INFO: if( zRight ){
    Index *pIdx;
    Table *pTab;
    pIdx = sqlite3FindIndex(db, zRight, zDb);




    if( pIdx ){
      static const char *azCol[] = {
         "seqno", "cid", "name", "desc", "coll", "key"
      };
      int i;
      int mx;
      if( pPragma->iArg ){







>
>
>
>







1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
  }
  break;

  case PragTyp_INDEX_INFO: if( zRight ){
    Index *pIdx;
    Table *pTab;
    pIdx = sqlite3FindIndex(db, zRight, zDb);
    if( pIdx==0 ){
      pTab = sqlite3FindTable(db, zRight, zDb);
      if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab);
    }
    if( pIdx ){
      static const char *azCol[] = {
         "seqno", "cid", "name", "desc", "coll", "key"
      };
      int i;
      int mx;
      if( pPragma->iArg ){

Changes to test/without_rowid1.test.

323
324
325
326
327
328
329



















330
331
332
} {1 {CHECK constraint failed: t70a}}
do_catchsql_test 7.3 {
  CREATE TABLE t70b(
     a INT CHECK( rowid!=33 ),
     b TEXT PRIMARY KEY
  ) WITHOUT ROWID;
} {1 {no such column: rowid}}




















  
finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
} {1 {CHECK constraint failed: t70a}}
do_catchsql_test 7.3 {
  CREATE TABLE t70b(
     a INT CHECK( rowid!=33 ),
     b TEXT PRIMARY KEY
  ) WITHOUT ROWID;
} {1 {no such column: rowid}}

# The PRAGMA index_info and index_xinfo pragmas work on 
# WITHOUT ROWID tables too, but not on rowid tables.
#
do_execsql_test 8.1 {
  CREATE TABLE t80a(a TEXT, b INT, c BLOB, PRIMARY KEY(c,b));
  PRAGMA index_info(t80a);
} {}
do_execsql_test 8.2 {
  PRAGMA index_xinfo(t80a);
} {}
do_execsql_test 8.3 {
  CREATE TABLE t80b(a TEXT, b INT, c BLOB, PRIMARY KEY(c,b)) WITHOUT ROWID;
  PRAGMA index_info(t80b);
} {0 2 c 1 1 b}
do_execsql_test 8.4 {
  PRAGMA index_xinfo(t80b);
} {0 2 c 0 BINARY 1 1 1 b 0 BINARY 1 2 0 a 0 BINARY 0}


  
finish_test