1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Show the preferred schema table names in the output of "PRAGMA table_list".

FossilOrigin-Name: 9147390d9885a37a62edc1058f313434627f1b59965c890877d2cb119e355c78
This commit is contained in:
drh
2021-11-04 14:04:20 +00:00
parent 06b7281c94
commit a4a871c286
9 changed files with 81 additions and 50 deletions

View File

@@ -1052,11 +1052,25 @@ struct BusyHandler {
/*
** Name of table that holds the database schema.
**
** The PREFERRED names are used whereever possible. But LEGACY is also
** used for backwards compatibility.
**
** 1. Queries can use either the PREFERRED or the LEGACY names
** 2. The sqlite3_set_authorizer() callback uses the LEGACY name
** 3. The PRAGMA table_list statement uses the PREFERRED name
**
** The LEGACY names are stored in the internal symbol hash table
** in support of (2). Names are translated using sqlite3PreferredTableName()
** for (3). The sqlite3FindTable() function takes care of translating
** names for (1).
**
** Note that "sqlite_temp_schema" can also be called "temp.sqlite_schema".
*/
#define DFLT_SCHEMA_TABLE "sqlite_master"
#define DFLT_TEMP_SCHEMA_TABLE "sqlite_temp_master"
#define ALT_SCHEMA_TABLE "sqlite_schema"
#define ALT_TEMP_SCHEMA_TABLE "sqlite_temp_schema"
#define LEGACY_SCHEMA_TABLE "sqlite_master"
#define LEGACY_TEMP_SCHEMA_TABLE "sqlite_temp_master"
#define PREFERRED_SCHEMA_TABLE "sqlite_schema"
#define PREFERRED_TEMP_SCHEMA_TABLE "sqlite_temp_schema"
/*
@@ -1068,7 +1082,7 @@ struct BusyHandler {
** The name of the schema table. The name is different for TEMP.
*/
#define SCHEMA_TABLE(x) \
((!OMIT_TEMPDB)&&(x==1)?DFLT_TEMP_SCHEMA_TABLE:DFLT_SCHEMA_TABLE)
((!OMIT_TEMPDB)&&(x==1)?LEGACY_TEMP_SCHEMA_TABLE:LEGACY_SCHEMA_TABLE)
/*
** A convenience macro that returns the number of elements in
@@ -4592,6 +4606,7 @@ Table *sqlite3FindTable(sqlite3*,const char*, const char*);
#define LOCATE_VIEW 0x01
#define LOCATE_NOERR 0x02
Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
const char *sqlite3PreferredTableName(const char*);
Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *);
Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);