Selecting rows by content of array type field

From: mito <milos(dot)orszag(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Selecting rows by content of array type field
Date: 2009-08-13 13:02:14
Message-ID: h612si$2fkq$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have table like this:
CREATE TABLE messages {
recepients varchar[],
};

Want to select by content co array type field recepients:
SELECT * FROM messages where 'john' ANY (recepients);

If i want to create index on recepients field, is it enough to

CREATE INDEX messages_recepients_index ON messages (recepients);

or is there other way how to index this? Expressions?

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2009-08-13 13:06:19 Re: multiple paramters in aggregate function
Previous Message Sim Zacks 2009-08-13 12:50:51 Re: multiple paramters in aggregate function