-C Properly\sfix\stemp\striggers\screated\sas\spart\sof\sFK\sprocessing\sto\stheir\sschemas.\sOtherwise\sthey\smay\sbecome\sconfused\sby\ssimilarly\snamed\schild\stables\sin\sother\sattached\sdatabases.\sFix\sfor\sforum\spost\s[forum:636bd0180a\s|\s636bd0180a].
-D 2026-03-16T11:14:26.814
+C Rework\sthe\s".indexes"\scommand\sof\sthe\sCLI.\s\s(1)\sThe\sPATTERN\snow\smatches\nthe\sname\sof\sthe\sindex\sitself,\snot\sthe\sname\sof\sthe\stable\scontaining\nthe\sindex,\sthus\smaking\sthe\spattern\sactually\suseful.\s\s(2)\s\sSystem-generated\nindexes\s(for\sUNIQUE\sconstraints\sand\ssimilar)\sare\somitted\sunless\nthe\s-a|-all\sor\s--sys\soptions\sare\sadded.\s\s(3)\sThe\s--expr\soption\scauses\nonly\sexpression\sindexes\sto\sbe\sshown.
+D 2026-03-16T15:35:41.736
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c ffe199f025a0dd74670d2a77232bdea364a4d7b36f32c64a6572d39ba6a11576
-F src/shell.c.in 5bfc926b756d5816fcaf56a30c3a363ba09ac09a9f6a5a7eef1b27c8bac8f6c4
+F src/shell.c.in 9b655b63ff8c15f04b23632d648cc2a7285882e6c2126fb9357b5b70e2454a0e
F src/sqlite.h.in 4d657846d68a58b028f0c4c331b9d3b4a79306f25c3b0d04fb56060343f73d85
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 1b7a0ee438bb5c2896d0609c537e917d8057b3340f6ad004d2de44f03e3d3cca
F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
-F test/shell1.test d714be78c063cfb5f0933dcf2b5d9df62ef57f8eaf8848bbd0026a9d252d4db5
+F test/shell1.test eda2e527435f139224dda67db6bbd2466597408d4fe5883d647d67fa32d88f7c
F test/shell2.test dc541d2681503e55466a24d35a4cbf8ca5b90b8fcdef37fc4db07373a67d31d3
F test/shell3.test 91efdd545097a61a1f72cf79c9ad5b49da080f3f10282eaf4c3c272cd1012db2
F test/shell4.test e25580a792b7b54560c3a76b6968bd8189261f38979fe28e6bc6312c5db280db
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P dc78d258745a1350685b37da56f0a2ac2e437b422415d634522dc61d340d06eb
-R f4cdffcb37cefef0e7ac6ef7ca48fea4
-U dan
-Z d215803567bcaa7157c0e213d8c093a7
+P 80bc5bc07e221f837c28066f0a438f11c8ab6be4c8ba93615439eb1667967003
+R 3ad37f8e404f71b8ecba081b76070ad6
+U drh
+Z d82e0cbe9c28448c805d23a2e1afab0e
# Remove this line to create a well-formed Fossil manifest.
#ifndef SQLITE_OMIT_TEST_CONTROL
".imposter INDEX TABLE Create imposter table TABLE on index INDEX",
#endif
- ".indexes ?TABLE? Show names of indexes",
- " If TABLE is specified, only show indexes for",
- " tables matching TABLE using the LIKE operator.",
+ ".indexes ?PATTERN? Show names of indexes matching PATTERN",
+ " -a|--all Also show system-generated indexes",
+ " --expr Show only expression indexes",
+ " --sys Show only system-generated indexes",
".intck ?STEPS_PER_UNLOCK? Run an incremental integrity check on the db",
#ifdef SQLITE_ENABLE_IOTRACE
",iotrace FILE Enable I/O diagnostic logging to FILE",
}else
#endif /* !defined(SQLITE_OMIT_TEST_CONTROL) */
+ if( c=='i' && (cli_strncmp(azArg[0], "indices", n)==0
+ || cli_strncmp(azArg[0], "indexes", n)==0)
+ ){
+ sqlite3_str *pSql;
+ int i;
+ int allFlag = 0;
+ int sysFlag = 0;
+ int exprFlag = 0;
+ int debugFlag = 0; /* Undocument --debug flag */
+ const char *zPattern = 0;
+ const char *zSep = "WHERE";
+
+ for(i=1; i<nArg; i++){
+ if( azArg[i][0]=='-' ){
+ const char *z = azArg[i]+1;
+ if( z[0]=='-' ) z++;
+ if( cli_strcmp(z,"all")==0 || cli_strcmp(z,"a")==0 ){
+ allFlag = 1;
+ }else
+ if( cli_strcmp(z,"sys")==0 ){
+ sysFlag = 1;
+ allFlag = 0;
+ }else
+ if( cli_strcmp(z,"expr")==0 ){
+ exprFlag = 1;
+ allFlag = 0;
+ }else
+ if( cli_strcmp(z,"debug")==0 ){
+ debugFlag = 1;
+ }else
+ {
+ dotCmdError(p, i, "unknown option", 0);
+ rc = 1;
+ goto meta_command_exit;
+ }
+ }else if( zPattern==0 ){
+ zPattern = azArg[i];
+ }else{
+ dotCmdError(p, i, "unknown argument", 0);
+ rc = 1;
+ goto meta_command_exit;
+ }
+ }
+
+ open_db(p, 0);
+ pSql = sqlite3_str_new(p->db);
+ sqlite3_str_appendf(pSql,
+ "SELECT if(t.schema='main',i.name,t.schema||'.'||i.name)\n"
+ "FROM pragma_table_list t, pragma_index_list(t.name,t.schema) i\n"
+ );
+ if( exprFlag ){
+ allFlag = 0;
+ sqlite3_str_appendf(pSql,
+ "%s (EXISTS(SELECT 1 FROM pragma_index_xinfo(i.name) WHERE cid=-2)\n"
+ " OR\n"
+ " EXISTS(SELECT cid FROM pragma_table_xinfo(t.name) WHERE hidden=2"
+ " INTERSECT "
+ " SELECT cid FROM pragma_index_info(i.name)))\n", zSep);
+ zSep = "AND";
+ }
+ if( sysFlag ){
+ sqlite3_str_appendf(pSql,
+ "%s i.name LIKE 'sqlite__autoindex__%%' ESCAPE '_'\n", zSep);
+ zSep = "AND";
+ }else if( !allFlag ){
+ sqlite3_str_appendf(pSql,
+ "%s i.name NOT LIKE 'sqlite__%%' ESCAPE '_'\n", zSep);
+ zSep = "AND";
+ }
+ if( zPattern ){
+ sqlite3_str_appendf(pSql, "%s i.name LIKE '%%%q%%'\n", zSep, zPattern);
+ }
+ sqlite3_str_appendf(pSql, "ORDER BY 1");
+
+ /* Run the SQL statement in "split" mode. */
+ if( debugFlag ){
+ cli_printf(stdout,"%s;\n", sqlite3_str_value(pSql));
+ }else{
+ modePush(p);
+ modeChange(p, MODE_Split);
+ shell_exec(p, sqlite3_str_value(pSql), 0);
+ modePop(p);
+ }
+ sqlite3_str_free(pSql);
+ }else
+
if( c=='i' && cli_strncmp(azArg[0], "intck", n)==0 ){
i64 iArg = 0;
if( nArg==2 ){
}
}else
- if( (c=='t' && n>1 && cli_strncmp(azArg[0], "tables", n)==0)
- || (c=='i' && (cli_strncmp(azArg[0], "indices", n)==0
- || cli_strncmp(azArg[0], "indexes", n)==0) )
- ){
+ if( (c=='t' && n>1 && cli_strncmp(azArg[0], "tables", n)==0) ){
sqlite3_stmt *pStmt;
sqlite3_str *pSql;
const char *zPattern = nArg>1 ? azArg[1] : 0;
return shellDatabaseError(p->db);
}
- if( nArg>2 && c=='i' ){
- /* It is an historical accident that the .indexes command shows an error
- ** when called with the wrong number of arguments whereas the .tables
- ** command does not. */
- eputz("Usage: .indexes ?LIKE-PATTERN?\n");
- rc = 1;
- sqlite3_finalize(pStmt);
- goto meta_command_exit;
- }
pSql = sqlite3_str_new(p->db);
while( sqlite3_step(pStmt)==SQLITE_ROW ){
const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
sqlite3_str_appendf(pSql, "SELECT %Q||'.'||name FROM ", zDbName);
}
sqlite3_str_appendf(pSql, "\"%w\".sqlite_schema", zDbName);
- if( c=='t' ){
- sqlite3_str_appendf(pSql,
- " WHERE type IN ('table','view')"
- " AND name NOT LIKE 'sqlite__%%' ESCAPE '_'"
- );
- if( zPattern ){
- sqlite3_str_appendf(pSql," AND name LIKE %Q", zPattern);
- }
- }else{
- sqlite3_str_appendf(pSql, " WHERE type='index'");
- if( zPattern ){
- sqlite3_str_appendf(pSql," AND tbl_name LIKE %Q", zPattern);
- }
+ sqlite3_str_appendf(pSql,
+ " WHERE type IN ('table','view')"
+ " AND name NOT LIKE 'sqlite__%%' ESCAPE '_'"
+ );
+ if( zPattern ){
+ sqlite3_str_appendf(pSql," AND name LIKE %Q", zPattern);
}
}
rc = sqlite3_finalize(pStmt);