Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling base table name by OID?

Status
Not open for further replies.

jisoo23

Programmer
Jan 27, 2004
192
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top