【发布时间】:2011-08-30 20:37:12
【问题描述】:
我想检查 psql 中的索引(和其他对象)。
我创建了索引:
CREATE INDEX my_index on "my_table" (iso_country_code, type_name, UPPER(name) varchar_pattern_ops);
在 psql 中我使用了 describe 命令:
db=> \d+ my_index
Index "public.my_index"
Column | Type | Storage | Description
------------------+------------------------+----------+-------------
iso_country_code | character varying(3) | extended |
type_name | character varying(300) | extended |
pg_expression_3 | text | extended |
btree, for table "public.my_table"
索引最后一个字段中的表达式只显示pg_expression_3。为什么表达式没有出现在 psql 输出中?
我可以使用 pg_dump 检索表架构,包括 CREATE INDEX 语句:
pg_dump --table my_table --schema-only my_db
【问题讨论】:
标签: sql database postgresql database-schema