LoginSignup
14
13

More than 5 years have passed since last update.

PostgreSQL 外部キー一覧の取得

Last updated at Posted at 2013-10-17

information_schema.table_constraints を参照する.

SELECT table_name, constraint_name
FROM information_schema.table_constraints
WHERE table_schema = 'public'
    AND constraint_type = 'FOREIGN KEY';

外部キー制約を削除するには…

ALTER TABLE <<table_name>>
DROP CONSTRAINT IF EXISTS <<constraint_name>>;
14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13