Q:

PostgreSQL - CREATE INDEX on an element of TYPE

I would like to create an index in an element of specific type.
Can you help me ? Thanks
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 !! 

A:

Please, try this:

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

And include a full error message if this doesn't works for you.

