search array field? - Mailing list pgsql-general

From mhewii@qix.net (Mark & Candice White)
Subject search array field?
Date
Msg-id 5e09903c.0202161541.2f143753@posting.google.com
Whole thread Raw
List pgsql-general
I need to do all the normal SQL stuff (SELECT,WHERE,ORDER BY)
on the elements of an array field.
I can not alter the schema, and the number of elements are
variable.

How do I do this?

table: name, data
"nameA",{"data1","data2"}
"nameB",{"data2","data3","data4"}
"nameC",{"data5"}

SELECT name, ?data? FROM table WHERE ?data? LIKE "data1" OR ?data? LIKE
"data2";

results=
nameA, data1
nameA, data2
nameB, data2

I am using PostgreSQL and PHP (the output is HTML).
I can get all the data, then pars it in php but that seems
like a wast of SQL, and impractical with any large number of records.
I would like to do it with as much SQL and little php as posible.

If this is a RTFM type question please tell me where in what M
to R.
Thank you.

pgsql-general by date:

Previous
From: rey4@columbia.edu (Russell Yanofsky)
Date:
Subject: Re: Can PostgreSQL be used with ASP or .NET?
Next
From: paul
Date:
Subject: VERY basic