FK constraints list

Table Owner Table name Constraint name Column name Referenced Table name Referenced Column name
postgres public.address address_city_id_fkey city_id city city_id
postgres public.city city_country_id_fkey country_id country country_id
postgres public.customer customer_address_id_fkey address_id address address_id
postgres public.customer customer_store_id_fkey store_id store store_id
postgres public.film film_original_language_id_fkey original_language_id language language_id
postgres public.film film_language_id_fkey language_id language language_id
postgres public.film_actor film_actor_film_id_fkey film_id film film_id
postgres public.film_actor film_actor_actor_id_fkey actor_id actor actor_id
postgres public.film_category film_category_category_id_fkey category_id category category_id
postgres public.film_category film_category_film_id_fkey film_id film film_id
postgres public.inventory inventory_film_id_fkey film_id film film_id
postgres public.inventory inventory_store_id_fkey store_id store store_id
postgres public.payment payment_customer_id_fkey customer_id customer customer_id
postgres public.payment payment_staff_id_fkey staff_id staff staff_id
postgres public.payment payment_rental_id_fkey rental_id rental rental_id
postgres public.payment_p2007_01 payment_p2007_01_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_01 payment_p2007_01_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_01 payment_p2007_01_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.payment_p2007_02 payment_p2007_02_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.payment_p2007_02 payment_p2007_02_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_02 payment_p2007_02_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_03 payment_p2007_03_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.payment_p2007_03 payment_p2007_03_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_03 payment_p2007_03_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_04 payment_p2007_04_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_04 payment_p2007_04_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.payment_p2007_04 payment_p2007_04_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_05 payment_p2007_05_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_05 payment_p2007_05_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_05 payment_p2007_05_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.payment_p2007_06 payment_p2007_06_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES customer(customer_id)
postgres public.payment_p2007_06 payment_p2007_06_rental_id_fkey FOREIGN KEY (rental_id) REFERENCES rental(rental_id)
postgres public.payment_p2007_06 payment_p2007_06_staff_id_fkey FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
postgres public.rental rental_customer_id_fkey customer_id customer customer_id
postgres public.rental rental_inventory_id_fkey inventory_id inventory inventory_id
postgres public.rental rental_staff_id_fkey staff_id staff staff_id
postgres public.staff staff_store_id_fkey FOREIGN KEY (store_id) REFERENCES store(store_id)
postgres public.staff staff_address_id_fkey address_id address address_id
postgres public.store store_manager_staff_id_fkey manager_staff_id staff staff_id
postgres public.store store_address_id_fkey address_id address address_id

SELECT rolname AS tableowner, nspname, relname AS tablename, conname, pg_get_constraintdef(pg_constraint.oid, true) as condef FROM pg_constraint, pg_class, pg_roles, pg_namespace WHERE conrelid=pg_class.oid AND relowner=pg_roles.oid AND relnamespace=pg_namespace.oid AND contype = 'f' ORDER BY 1, 2, 3