我使用 PostgreSQL。是否有一个查询来获取对序列列没有唯一约束的所有表的列表?如果它有助于形成查询,我将“引用”用于我的序列列。
这是包含 this.das 的表的示例
\d+ a_practical_approach_when_there_is_a_lot_to_do
Table "public.a_practical_approach_when_there_is_a_lot_to_do"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------------------+--------------------------+-----------+----------+-----------------------------------------------------------------------------------+----------+--------------+-------------
reference | bigint | | not null | nextval('a_practical_approach_when_there_is_a_lot_to_do_reference_seq'::regclass) | plain | |
display_order | bigint | | | | plain | |
principal | text | | | | extended | |
explanation | text | | | | extended | |
add_date | timestamp with time zone | | | | plain | | UTC
membership_reference | bigint | | | | plain | |
Indexes:
"a_practical_approach_when_there_is_a_lot_to_do_reference_unique" UNIQUE CONSTRAINT, btree (reference)
Access method: heap
搜索具有名为非主键的
information_schema
列的表很容易:reference