Hello all,
I'm trying to find the table names that belong to their respective foreign keys. So far, I've tried querying pg_constraint to pull all foreign keys and their respective base tables' OIDs. Then I try to query the pg_class table, which has the information I need (relname, or table name) but not sure what to query by. There is a column I could reference called "relnamespace" that takes in an OID. Does anyone know if this is the right way to pull the table name belonging to each foreign key?
Thanks,
Jisoo23
I'm trying to find the table names that belong to their respective foreign keys. So far, I've tried querying pg_constraint to pull all foreign keys and their respective base tables' OIDs. Then I try to query the pg_class table, which has the information I need (relname, or table name) but not sure what to query by. There is a column I could reference called "relnamespace" that takes in an OID. Does anyone know if this is the right way to pull the table name belonging to each foreign key?
Thanks,
Jisoo23