I have a postgresql database consisting more than 600 tables.
This is my situation roughly:
Table1{
column1 data_type,
column2 data_type,
constraint const_name1 foreign key(column1)
references Table2(table_id)
constraint const_name2 foreign key(column2)
references Table2(table_id)
}
Table2{
table_id data_type
}
Now I need to find the Table1's, Where more than one column has referenced the same table Table2 on the same column. And with that hugh number of tables, it is not possible to find them manually.
Is there a sql available for this? Any ideas? Thanks in advance.