【发布时间】:2020-11-13 08:13:04
【问题描述】:
我正在从 MySQL 迁移到 PostgreSQL。我需要在表中找到所有具有唯一约束的列。 PostgreSQL 中以下查询的等价物是什么?
SELECT column_name, index_name
FROM information_schema.statistics
WHERE table_schema='db' and table_name='tb' and non_unique=0 and index_name != 'PRIMARY'
【问题讨论】:
-
感谢@ThomasG!该链接肯定有帮助。我从下面的 Adrian 那里找到了我所需要的答案。
标签: mysql postgresql