PostgreSQL - 在TYPE元素上创建INDEX

时间:2012-07-04 08:01:41

标签: postgresql types indexing

我想在特定类型的元素中创建索引。

你能帮帮我吗?感谢

CREATE TYPE taddress AS (
 street1 varchar,
 street2 varchar,
 zipcode varchar,
 city varchar
);

CREATE TABLE person (
    id serial primary key,
    firstname varchar not null,
    lastname varchar not null,
    address taddress);

CREATE INDEX idx_street1 ON person ((address).street2); -- <- Doesn't work !! 

1 个答案:

答案 0 :(得分:1)

请试试这个:

CREATE INDEX idx_street1 ON person (((address).street2));

如果这不适合您,请提供完整的错误消息。