3

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 !! 

1 Answer 1

1

Please, try this:

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

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.