refactor(db): define the "TREK's tables" catalog query once

The bootstrap's currentTables and the client tools' pgTableNames each wrote
the same information_schema query for the current schema, so a change to
which tables count as TREK's would have had to land twice. It is now
CURRENT_SCHEMA_TABLES_SQL in dialect/catalog.ts, beside the other catalog
statements, and both read it.

pgTableNames now lists its names in name order too, as the bootstrap
already did. Nothing reads that order for meaning; the boot-restore refusal
names the first few tables, and that list was already sorted.
This commit is contained in:
Isaias Tavares
2026-11-05 00:21:55 -03:00
parent 1c73ac4c35
commit 0e93df378f
3 changed files with 13 additions and 9 deletions
+9
View File
@@ -26,3 +26,12 @@ export function tableExistsSql(platform: Platform): string {
}
return unsupported(platform);
}
/**
* The tables in the current schema, one `table_name` per row in name order:
* the schema TREK's own tables live in. Postgres only, and the one definition
* of that question: the bootstrap reads it through the connection, the client
* tools' table listing hands it to psql.
*/
export const CURRENT_SCHEMA_TABLES_SQL =
'select table_name from information_schema.tables where table_schema = current_schema() order by table_name';