Regular expression and array

From: Nick <nboutelier(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Regular expression and array
Date: 2009-05-27 03:04:02
Message-ID: 196461c6-0486-4e29-bb84-3996d024a080@z16g2000prd.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I wont go into details about why im using this field as an array but
how would I select all the rows that have the first name 'Tom' out of
the 'names' field?

CREATE TABLE test (
id integer,
names character varying[]
);
INSERT INTO test VALUES (1, '{"''Josh Berkus''","''Peter
Eisentraut''","''Marc Fournier''"}');
INSERT INTO test VALUES (2, '{"''Tom Lane''","''Bruce
Momjian''","''Dave Page''"}');
INSERT INTO test VALUES (3, '{"''Jan Wieck''","''Oleg
Bartunov''","''Joe Conway''"}');

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anirban Pal 2009-05-27 07:51:40 Postgres registry access using java
Previous Message Scott Marlowe 2009-05-27 01:48:34 Re: How to speed up the first-time-searching in pgsql?