SELECT con.* FROM pg_catalog.pg_constraint con INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace WHERE nsp.nspname = '<schema name>' AND rel.relname = '<table name>';...
# \d+ observations.stream Table "observations.stream" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+-------------------+-----------+----------+---------+----------+--------------+--------------------------------------------- id | integer | | not null | | plain | | name | character varying | | not null | | extended | | This should be a table in the import schema min_id | integer | | not null | | plain | | about | character varying | | not null | | extended | | Indexes: "stream_pkey" PRIMARY KEY, btree (id) "stream_name_key" UNIQUE CONSTRAINT, btree (name) Check constraints: "stream_id_check" CHECK (id > 0) Referenced by: TABLE "profile" CONSTRAINT "profile_id_stream_fkey" FOREIGN KEY (id_stream) REFERENCES stream(id)postgresql — PostgreSQLのテーブルのすべての制約をリストする方法は?