Bug
TABLE_RELATIONSHIPS_SQL / VIEWS_KEY_DEPENDENCIES_SQL filter some clauses with connamespace::regnamespace::text, while the outer table filter correctly uses nspname.
For schemas that need quoting, those differ:
| nspname |
::regnamespace::text |
odd.schema |
"odd.schema" |
MySchema |
"MySchema" |
So IN ('odd.schema') matches nspname but misses regnamespace::text. The FK lateral still returns a row (aggregate), but with null columns / referenced_columns.
Impact
Typegen relationship inference (PostgresMetaRelationships) drops FK column info for projects that use dotted or mixed-case schema names.
Repro
create schema "odd.schema";
create table "odd.schema".parent (id int8 primary key);
create table "odd.schema".child (
id int8 primary key,
parent_id int8 references "odd.schema".parent (id)
);
Then relationships.list({ includedSchemas: ['odd.schema'] }) — relationship exists but columns / referenced_columns are null.
Expected
Filter by nspname (or oid via pg_namespace) consistently so column lists are populated.
Bug
TABLE_RELATIONSHIPS_SQL/VIEWS_KEY_DEPENDENCIES_SQLfilter some clauses withconnamespace::regnamespace::text, while the outer table filter correctly usesnspname.For schemas that need quoting, those differ:
::regnamespace::textodd.schema"odd.schema"MySchema"MySchema"So
IN ('odd.schema')matchesnspnamebut missesregnamespace::text. The FK lateral still returns a row (aggregate), but with nullcolumns/referenced_columns.Impact
Typegen relationship inference (
PostgresMetaRelationships) drops FK column info for projects that use dotted or mixed-case schema names.Repro
Then
relationships.list({ includedSchemas: ['odd.schema'] })— relationship exists butcolumns/referenced_columnsare null.Expected
Filter by
nspname(or oid viapg_namespace) consistently so column lists are populated.