Skip to content

Commit 59652a7

Browse files
committed
fix: use schema namespace to assure that when tables with the same name exist in multiple schemas the properties are read properly
1 parent b82a013 commit 59652a7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/dialects/postgres.parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ export class PostgresParser extends BaseDatabaseParser {
171171
where attrelid = c.conrelid and ARRAY[attnum] <@ c.conkey) as col,
172172
(select r.relname from pg_class r where r.oid = c.confrelid) as referenced_table
173173
from pg_constraint c
174-
where c.conrelid = (select oid from pg_class where relname = '${table}')
174+
where c.conrelid = (select oid from pg_class where relname = '${table}' and relnamespace =
175+
(select oid from pg_namespace where nspname = '${schemaName}'))
175176
and (select r.relname from pg_class r where r.oid = c.confrelid) is not null
176177
`);
177178

0 commit comments

Comments
 (0)