Skip to content

Instantly share code, notes, and snippets.

View israelins85's full-sized avatar

Israel Lins Albuquerque israelins85

  • Fortaleza Ceará Brasil
View GitHub Profile
@velosipedist
velosipedist / postgresql-list-foreign-keys.sql
Created October 31, 2013 13:52
List all foreign keys in PostgreSQL database, analog of MySQL SHOW CREATE TABLE mytable;
--- Source: http://solaimurugan.blogspot.ru/2010/10/list-out-all-forien-key-constraints.html
SELECT
tc.constraint_name,
tc.constraint_type,
tc.table_name,
kcu.column_name,
tc.is_deferrable,
tc.initially_deferred,
rc.match_option AS match_type,