Skip to content
Advertisement

Tag: system-views

List all foreign keys PostgreSQL

I need a query that returns: “table_name”, “field_name”, “field_type”, “contraint_name” until now i have: Answer A foreign key may be based on multiple columns, so conkey and confkey of pg_constraint are arrays. You have to unnest the arrays to get a list of column names or types. You can use these functions: The functions may be very handy when querying

Advertisement