You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select tc.table_schema,
tc.constraint_type,
tc.constraint_name,
tc.table_name,
kcu.column_name,
ccu.table_schema AS foreign_table_schema,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM information_schema.table_constraints as tc
JOIN information_schema.key_column_usage as kcu
on tc.constraint_name = kcu.constraint_name
AND tc.table_schema = kcu.table_schema
JOIN information_schema.constraint_column_usage as ccu
ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
AND tc.table_schema = 'tenant1'
and tc.table_name = 'note';
Screenshots or Crash reports
PGAdmin showing correctly after export the table
The text was updated successfully, but these errors were encountered:
Preconditions
Describe the bug
**i am using postgress table to create multiple schemas with same table definition.
if i am creating 3 schema in each specific schema 3 foreign key are creating which is incorrect.
Correct Behavior : it should create one foreign key instead of multiple ref from another schema**
Reproduceble script :
https://raw.githubusercontent.com/jeebendu/schema-based-multi-tenancy/main/src/main/resources/db/migration/postgress_fk_issue.sql
select tc.table_schema,
tc.constraint_type,
tc.constraint_name,
tc.table_name,
kcu.column_name,
ccu.table_schema AS foreign_table_schema,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM information_schema.table_constraints as tc
JOIN information_schema.key_column_usage as kcu
on tc.constraint_name = kcu.constraint_name
AND tc.table_schema = kcu.table_schema
JOIN information_schema.constraint_column_usage as ccu
ON ccu.constraint_name = tc.constraint_name
WHERE tc.constraint_type = 'FOREIGN KEY'
AND tc.table_schema = 'tenant1'
and tc.table_name = 'note';
Screenshots or Crash reports
PGAdmin showing correctly after export the table
The text was updated successfully, but these errors were encountered: