]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the "PRAGMA index_info" and "PRAGMA index_xinfo" statements so that index-info-on-table
authordrh <drh@noemail.net>
Tue, 25 Oct 2016 15:39:58 +0000 (15:39 +0000)
committerdrh <drh@noemail.net>
Tue, 25 Oct 2016 15:39:58 +0000 (15:39 +0000)
they work on WITHOUT ROWID tables and provide information about the underlying
index btree that implements the WITHOUT ROWID table.

FossilOrigin-Name: fe49fb03133fec8bed51c2e2c1b6848ab9fc563e

manifest
manifest.uuid
src/pragma.c
test/without_rowid1.test

index d4950ff1c57c1972b1c00e07393873ceb3f0bda1..c7ce587e80231e6db5a31970e9892609fd671526 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\stest\scase\sto\sdemonstrate\sa\s"BEGIN\sEXCLUSIVE"\scommand\sreturning\nSQLITE_BUSY_SNAPSHOT.
-D 2016-10-25T15:06:11.142
+C Enhance\sthe\s"PRAGMA\sindex_info"\sand\s"PRAGMA\sindex_xinfo"\sstatements\sso\sthat\nthey\swork\son\sWITHOUT\sROWID\stables\sand\sprovide\sinformation\sabout\sthe\sunderlying\nindex\sbtree\sthat\simplements\sthe\sWITHOUT\sROWID\stable.
+D 2016-10-25T15:39:58.696
 F Makefile.in 6fd48ffcf7c2deea7499062d1f3747f986c19678
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 5151cc64c4c05f3455f4f692ad11410a810d937f
@@ -380,7 +380,7 @@ F src/parse.y 0338f906b61e311c2b7e11a3f89b0092c780b664
 F src/pcache.c 5ff2a08f76a9c1b22f43eb063b7068fb085465ac
 F src/pcache.h 2cedcd8407eb23017d92790b112186886e179490
 F src/pcache1.c e3967219b2a92b9edcb9324a4ba75009090d3953
-F src/pragma.c d932ba278654617cdd281f88a790a3185fca7c44
+F src/pragma.c 18a2b0aa050396725e8ebb74b055d5afa802b54f
 F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
 F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
 F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1
@@ -1429,7 +1429,7 @@ F test/with1.test cef099a491eac9874f2c28bd2dc86394fb3e47b3
 F test/with2.test 2b40da883658eb74ad8ad06afabe11a408e7fb87
 F test/with3.test 511bacdbe41c49cf34f9fd1bd3245fe1575bca98
 F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
-F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701
+F test/without_rowid1.test eaac24556ed2dfaf84d8a32fac46229bd61b1015
 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
 F test/without_rowid3.test aad4f9d383e199349b6c7e508a778f7dff5dff79
 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
@@ -1527,7 +1527,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 98795c2dd9a6d8fa8d49a9f5c36cdf824cae7246
-R e30d5f9c1b1789e2c9a0ef25079fdb1b
-U dan
-Z 8c4ba873f6fa2463459d3dd02e3529e2
+P b115856408b6aa5538be67beb619d7aff0630bea
+R 169c1df42ad3211c7cffa140b51fc0ef
+T *branch * index-info-on-table
+T *sym-index-info-on-table *
+T -sym-trunk *
+U drh
+Z c67713b53054dcc5980cf7c3020b1123
index 9cf0539683242ef90be91b8c59b05663f583eaec..bee5cddb5b7830f245e05041480350ce9b817056 100644 (file)
@@ -1 +1 @@
-b115856408b6aa5538be67beb619d7aff0630bea
\ No newline at end of file
+fe49fb03133fec8bed51c2e2c1b6848ab9fc563e
\ No newline at end of file
index e774de34219d61b053c613865e18bce3cc7715c0..cc31ed006a1ce9ba32c7783d0a013184c2677dc5 100644 (file)
@@ -1122,6 +1122,10 @@ void sqlite3Pragma(
     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"
index 0c77773abb3e7812fb19c5f8ff76c8a91c835f6b..23fac402fffdf7f0807e18b6c331ef3cca206221 100644 (file)
@@ -328,5 +328,24 @@ do_catchsql_test 7.3 {
   ) 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