do_test rtree-1.1.1 {
execsql { CREATE VIRTUAL TABLE t1 USING rtree(ii, x1, x2, y1, y2) }
} {}
-do_test rtree-1.1.2 {
+do_test rtree-1.1.2a {
execsql { SELECT name FROM sqlite_master ORDER BY name }
} {t1 t1_node t1_parent t1_rowid}
+do_execsql_test rtree-1.1.2b {
+ SELECT name FROM pragma_table_list WHERE type='shadow' ORDER BY name;
+} {t1_node t1_parent t1_rowid}
do_test rtree-1.1.3 {
execsql {
DROP TABLE t1;
-C Accomplish\sfileio\sstandalone\sfor\sWin32\swith\sless\sintervention.
-D 2021-09-20T21:42:39.389
+C Add\sthe\s"PRAGMA\stable_list"\scommand\swith\sits\scorresponding\seponymous\ntable-valued\sfunction:\s"pragma_table_list".
+D 2021-09-21T17:26:23.956
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/rtree/geopoly.c 98d45533989e908bf65b43f36ff6eaad95a9ffe6f3b6b8658fbd47d45c58b10b
F ext/rtree/rtree.c fb930d5bee9deb9efbfbed72be56a0d4e4950ab216284fb5ec1c9863d32a32fa
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
-F ext/rtree/rtree1.test 00792b030a4e188ff1b22e8530e8aa0452bb5dd81c2b18cb004afc7dc63e040e
+F ext/rtree/rtree1.test 35c3bc0def71317b7601ee0d1149e7df2cd8fc4f13ec89a64761ac3f46ca123f
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
F ext/rtree/rtree3.test 4ee5d7df86040efe3d8d84f141f2962a7745452200a7cba1db06f86d97050499
F ext/rtree/rtree4.test 304de65d484540111b896827e4261815e5dca4ce28eeecd58be648cd73452c4b
F src/pcache.c 084e638432c610f95aea72b8509f0845d2791293f39d1b82f0c0a7e089c3bb6b
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 54881292a9a5db202b2c0ac541c5e3ef9a5e8c4f1c1383adb2601d5499a60e65
-F src/pragma.c 2b31671ff0cc1653e5e0544adfc80f46a8165c3f6d1c014dfc62c922859df85a
-F src/pragma.h a11b4798f9c49f156f130e1f7041a9fcc9d316a64f3501b6013acdd2e4c6f549
+F src/pragma.c 4a473feae3646063996ce3bfae78032009fa950765908d97424f7578b202813c
+F src/pragma.h b33c7a542ae7965c471f0d3c0565ce4d340c3f32cc162f44133539b6b0edb927
F src/prepare.c 0d53d20532aada295c1690792a125adbd6435f5ce703ff0adf1b9b3605238b67
F src/printf.c 78fabb49b9ac9a12dd1c89d744abdc9b67fd3205e62967e158f78b965a29ec4b
F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
F test/statfault.test f525a7bf633e50afd027700e9a486090684b1ac1
F test/stmt.test 54ed2cc0764bf3e48a058331813c3dbd19fc1d0827c3d8369914a5d8f564ec75
F test/stmtvtab1.test 6873dfb24f8e79cbb5b799b95c2e4349060eb7a3b811982749a84b359468e2d5
-F test/strict1.test 1e80c6ae71702c7cebacbc9c61d0c58e270b4cc8004c187296e39432015bf2be
+F test/strict1.test ac29180be09313af1d5086420e8b7a832f9bf777653c4cbc64d7fd478000b3f0
F test/strict2.test e78cedd56eb1c3e0b09b16c594dbfcb7e95bc6d85f68f0fd6501c243be28e219
F test/subjournal.test 8d4e2572c0ee9a15549f0d8e40863161295107e52f07a3e8012a2e1fdd093c49
F test/subquery.test d7268d193dd33d5505df965399d3a594e76ae13f
F test/vacuummem.test 7b42abb3208bd82dd23a7536588396f295a314f2
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
-F test/view.test ea88361d5e9bc8eabf9f573185a16aea73a885be9b6c6a95ae84908913416a80
+F test/view.test 798cf7936dda022d3ab0a4871685410d1c3b2a525b6b213915abc836e82a1078
F test/view2.test db32c8138b5b556f610b35dfddd38c5a58a292f07fda5281eedb0851b2672679
F test/vtab1.test 772c94825d455dffc5da34dcf4b648d8a23887616185fa024a472bf745e56df8
F test/vtab2.test 14d4ab26cee13ba6cf5c5601b158e4f57552d3b055cdd9406cf7f711e9c84082
F test/with5.test 6248213c41fab36290b5b73aa3f937309dfba337004d9d8434c3fabc8c7d4be8
F test/with6.test 661d7e416bef6c0a2556b2c9f0c8178a5b15932bed65246abed99723a8d4e7c0
F test/withM.test 693b61765f2b387b5e3e24a4536e2e82de15ff64
-F test/without_rowid1.test 6abc5d497f634520944dac0a89a6c240a48d2ee0f8353356a750eb70dc1db41a
+F test/without_rowid1.test a1c144156d1d21eea7b2b0db62ad0aaed37d4e163eb5758ae6b6647cc0b4412f
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
F test/without_rowid3.test 39ab0dd773eaa62e59b17093f875327630f54c4145458f6d2b053d68d4b2f67b
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
F tool/mkopcodeh.tcl 130b88697da6ec5b89b41844d955d08fb62c2552e889dec8c7bcecb28d8f50bd
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
-F tool/mkpragmatab.tcl 7f6db47d1995bc08247255622524567b2ab8962d98063f8aef97e35c3c54e3b8
+F tool/mkpragmatab.tcl 056338994c2a816076342dc1035294db3980152f514050067659af3ea4526361
F tool/mkshellc.tcl df5d249617f9cc94d5c48eb0401673eb3f31f383ecbc54e8a13ca3dd97e89450
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d1cc3105b2baceb9f426fd6bc8d8317de3af09a0f02517715bd292c68e282fa1
-R b25569838c321c8a1dce73819376c2fc
-U larrybr
-Z 29bd4bd5979c45d391558f5226ed2e5b
+P af5dcc9c2a3a45d10b985f6b7ea18d39c75502ed10fa6496aad787dbe8c8c3fb
+R b7f36cbc91c6a24f15ccb096ef89f4e1
+U drh
+Z cb33f0f0128d5123d146e61157efe535
-af5dcc9c2a3a45d10b985f6b7ea18d39c75502ed10fa6496aad787dbe8c8c3fb
\ No newline at end of file
+2c0e7ae541e9ecb86aa58fa7e7057def8aac1b1af1af1aa80b8bf2d260f9a2f9
\ No newline at end of file
}
break;
+ /*
+ ** PRAGMA table_list
+ **
+ ** Return a single row for each table, virtual table, or view in the
+ ** entire schema.
+ **
+ ** schema: Name of attached database hold this table
+ ** name: Name of the table itself
+ ** type: "table", "view", "virtual", "shadow"
+ ** ncol: Number of columns
+ ** wr: True for a WITHOUT ROWID table
+ ** strict: True for a STRICT table
+ */
+ case PragTyp_TABLE_LIST: {
+ int ii;
+ pParse->nMem = 6;
+ sqlite3CodeVerifyNamedSchema(pParse, zDb);
+ for(ii=0; ii<db->nDb; ii++){
+ HashElem *k;
+ Hash *pHash;
+ if( zDb && sqlite3_stricmp(zDb, db->aDb[ii].zDbSName)!=0 ) continue;
+ pHash = &db->aDb[ii].pSchema->tblHash;
+ for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k) ){
+ Table *pTab = sqliteHashData(k);
+ const char *zType;
+ if( zRight && sqlite3_stricmp(zRight, pTab->zName)!=0 ) continue;
+ if( IsView(pTab) ){
+ zType = "view";
+ }else if( IsVirtual(pTab) ){
+ zType = "virtual";
+ }else if( pTab->tabFlags & TF_Shadow ){
+ zType = "shadow";
+ }else{
+ zType = "table";
+ }
+ sqlite3VdbeMultiLoad(v, 1, "sssiii",
+ db->aDb[ii].zDbSName,
+ pTab->zName,
+ zType,
+ pTab->nCol,
+ (pTab->tabFlags & TF_WithoutRowid)!=0,
+ (pTab->tabFlags & TF_Strict)!=0
+ );
+ }
+ }
+ }
+ break;
+
#ifdef SQLITE_DEBUG
case PragTyp_STATS: {
Index *pIdx;
#define PragTyp_SOFT_HEAP_LIMIT 35
#define PragTyp_SYNCHRONOUS 36
#define PragTyp_TABLE_INFO 37
-#define PragTyp_TEMP_STORE 38
-#define PragTyp_TEMP_STORE_DIRECTORY 39
-#define PragTyp_THREADS 40
-#define PragTyp_WAL_AUTOCHECKPOINT 41
-#define PragTyp_WAL_CHECKPOINT 42
-#define PragTyp_LOCK_STATUS 43
-#define PragTyp_STATS 44
+#define PragTyp_TABLE_LIST 38
+#define PragTyp_TEMP_STORE 39
+#define PragTyp_TEMP_STORE_DIRECTORY 40
+#define PragTyp_THREADS 41
+#define PragTyp_WAL_AUTOCHECKPOINT 42
+#define PragTyp_WAL_CHECKPOINT 43
+#define PragTyp_LOCK_STATUS 44
+#define PragTyp_STATS 45
/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
/* 13 */ "pk",
/* 14 */ "hidden",
/* table_info reuses 8 */
- /* 15 */ "seqno", /* Used by: index_xinfo */
- /* 16 */ "cid",
- /* 17 */ "name",
- /* 18 */ "desc",
- /* 19 */ "coll",
- /* 20 */ "key",
- /* 21 */ "name", /* Used by: function_list */
- /* 22 */ "builtin",
- /* 23 */ "type",
- /* 24 */ "enc",
- /* 25 */ "narg",
- /* 26 */ "flags",
- /* 27 */ "tbl", /* Used by: stats */
- /* 28 */ "idx",
- /* 29 */ "wdth",
- /* 30 */ "hght",
- /* 31 */ "flgs",
- /* 32 */ "seq", /* Used by: index_list */
- /* 33 */ "name",
- /* 34 */ "unique",
- /* 35 */ "origin",
- /* 36 */ "partial",
- /* 37 */ "table", /* Used by: foreign_key_check */
- /* 38 */ "rowid",
- /* 39 */ "parent",
- /* 40 */ "fkid",
- /* index_info reuses 15 */
- /* 41 */ "seq", /* Used by: database_list */
- /* 42 */ "name",
- /* 43 */ "file",
- /* 44 */ "busy", /* Used by: wal_checkpoint */
- /* 45 */ "log",
- /* 46 */ "checkpointed",
- /* collation_list reuses 32 */
- /* 47 */ "database", /* Used by: lock_status */
- /* 48 */ "status",
- /* 49 */ "cache_size", /* Used by: default_cache_size */
+ /* 15 */ "schema", /* Used by: table_list */
+ /* 16 */ "name",
+ /* 17 */ "type",
+ /* 18 */ "ncol",
+ /* 19 */ "wr",
+ /* 20 */ "strict",
+ /* 21 */ "seqno", /* Used by: index_xinfo */
+ /* 22 */ "cid",
+ /* 23 */ "name",
+ /* 24 */ "desc",
+ /* 25 */ "coll",
+ /* 26 */ "key",
+ /* 27 */ "name", /* Used by: function_list */
+ /* 28 */ "builtin",
+ /* 29 */ "type",
+ /* 30 */ "enc",
+ /* 31 */ "narg",
+ /* 32 */ "flags",
+ /* 33 */ "tbl", /* Used by: stats */
+ /* 34 */ "idx",
+ /* 35 */ "wdth",
+ /* 36 */ "hght",
+ /* 37 */ "flgs",
+ /* 38 */ "seq", /* Used by: index_list */
+ /* 39 */ "name",
+ /* 40 */ "unique",
+ /* 41 */ "origin",
+ /* 42 */ "partial",
+ /* 43 */ "table", /* Used by: foreign_key_check */
+ /* 44 */ "rowid",
+ /* 45 */ "parent",
+ /* 46 */ "fkid",
+ /* index_info reuses 21 */
+ /* 47 */ "seq", /* Used by: database_list */
+ /* 48 */ "name",
+ /* 49 */ "file",
+ /* 50 */ "busy", /* Used by: wal_checkpoint */
+ /* 51 */ "log",
+ /* 52 */ "checkpointed",
+ /* collation_list reuses 38 */
+ /* 53 */ "database", /* Used by: lock_status */
+ /* 54 */ "status",
+ /* 55 */ "cache_size", /* Used by: default_cache_size */
/* module_list pragma_list reuses 9 */
- /* 50 */ "timeout", /* Used by: busy_timeout */
+ /* 56 */ "timeout", /* Used by: busy_timeout */
};
/* Definitions of all built-in pragmas */
{/* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 50, 1,
+ /* ColNames: */ 56, 1,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{/* zName: */ "cache_size",
{/* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 32, 2,
+ /* ColNames: */ 38, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
{/* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
- /* ColNames: */ 41, 3,
+ /* ColNames: */ 47, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
{/* zName: */ "default_cache_size",
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
- /* ColNames: */ 49, 1,
+ /* ColNames: */ 55, 1,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{/* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt,
- /* ColNames: */ 37, 4,
+ /* ColNames: */ 43, 4,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
{/* zName: */ "function_list",
/* ePragTyp: */ PragTyp_FUNCTION_LIST,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 21, 6,
+ /* ColNames: */ 27, 6,
/* iArg: */ 0 },
#endif
#endif
{/* zName: */ "index_info",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
- /* ColNames: */ 15, 3,
+ /* ColNames: */ 21, 3,
/* iArg: */ 0 },
{/* zName: */ "index_list",
/* ePragTyp: */ PragTyp_INDEX_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
- /* ColNames: */ 32, 5,
+ /* ColNames: */ 38, 5,
/* iArg: */ 0 },
{/* zName: */ "index_xinfo",
/* ePragTyp: */ PragTyp_INDEX_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
- /* ColNames: */ 15, 6,
+ /* ColNames: */ 21, 6,
/* iArg: */ 1 },
#endif
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
{/* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 47, 2,
+ /* ColNames: */ 53, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{/* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
- /* ColNames: */ 27, 5,
+ /* ColNames: */ 33, 5,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 8, 6,
/* iArg: */ 0 },
+ {/* zName: */ "table_list",
+ /* ePragTyp: */ PragTyp_TABLE_LIST,
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1,
+ /* ColNames: */ 15, 6,
+ /* iArg: */ 1 },
{/* zName: */ "table_xinfo",
/* ePragTyp: */ PragTyp_TABLE_INFO,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
{/* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlg: */ PragFlg_NeedSchema,
- /* ColNames: */ 44, 3,
+ /* ColNames: */ 50, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
/* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError },
#endif
};
-/* Number of pragmas: 67 on by default, 77 total. */
+/* Number of pragmas: 68 on by default, 78 total. */
d TEXT,
e REAL
) STRICT;
-} {}
+ SELECT strict FROM pragma_table_list('t1');
+} {1}
do_catchsql_test strict1-2.1 {
INSERT INTO t1(a) VALUES('xyz');
} {1 {cannot store TEXT value in INT column t1.a}}
INSERT INTO t1(e) VALUES('xyz');
} {1 {cannot store TEXT value in REAL column t1.e}}
+
do_execsql_test strict1-3.1 {
INSERT INTO t1(a, b) VALUES(1,2),('3','4'),(5.0, 6.0),(null,null);
SELECT a, b, '|' FROM t1;
SELECT * FROM v1temp ORDER BY a;
}
} {0 {1 2 4 5 7 8 1 2 4 5 7 8}}
+do_execsql_test view-1.1.120 {
+ SELECT name, type FROM pragma_table_list('v1');
+} {v1 view}
do_test view-1.2 {
catchsql {
ROLLBACK;
do_execsql_test_if_vtab without_rowid1-1.0ixi {
SELECT name, key FROM pragma_index_xinfo('t1');
} {c 1 a 1 b 0 d 0}
+do_execsql_test_if_vtab without_rowid1-1.0tl {
+ SELECT wr FROM pragma_table_list('t1');
+} {1}
do_execsql_test without_rowid1-1.1 {
SELECT *, '|' FROM t1 ORDER BY +c, a;
COLS: cid name type notnull dflt_value pk hidden
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
+ NAME: table_list
+ TYPE: TABLE_LIST
+ FLAG: NeedSchema Result1 SchemaOpt
+ COLS: schema name type ncol wr strict
+ IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
+
NAME: stats
FLAG: NeedSchema Result0 SchemaReq
COLS: tbl idx wdth hght flgs