Skip to content

Commit 479d10a

Browse files
committed
fix: fetching primary key when it exists in multiple schemas
1 parent b8f71f7 commit 479d10a

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

cjs/src/postgres.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function getTableDefinitions (sql, schema) {
4444
FROM information_schema.table_constraints tc
4545
WHERE tc.constraint_name = i.relname
4646
AND tc.constraint_type = 'PRIMARY KEY'
47+
AND tc.table_schema = ${schema}
4748
) IS NOT NULL
4849
)
4950
FROM pg_class t1,

src/postgres.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function getTableDefinitions (sql, schema) {
4444
FROM information_schema.table_constraints tc
4545
WHERE tc.constraint_name = i.relname
4646
AND tc.constraint_type = 'PRIMARY KEY'
47+
AND tc.table_schema = ${schema}
4748
) IS NOT NULL
4849
)
4950
FROM pg_class t1,

0 commit comments

Comments
 (0)