Query-ing arrays

From: Jon Lapham <jlapham(at)gandalf(dot)bioqmed(dot)ufrj(dot)br>
To: pgsql-sql(at)postgresql(dot)org
Subject: Query-ing arrays
Date: 2000-09-01 15:27:04
Message-ID: 20000901122704.A19497@gandalf.bioqmed.ufrj.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stupid FAQ probably:

Is it possible to query an array for an item WITHOUT KNOWING where in the
array the item might be held?

For example, I have a tbale with the following character array:
> category char(3)[],

I would like to find all records in which 'category' contains an array
element of a certain type, like maybe 'xxx' for instance. So, for a
particular record, 'category' may be set to '{'gfe','qwe','xcs','xxx'}'

I cannot do:
SELECT * FROM blah WHERE category[4]='xxx';
because I do not know that the 'xxx' will always be in the 4th position.

Suggestions? TIA, Jon

--

-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
Jon Lapham
Centro Nacional de Ressonancia Magnetica Nuclear de Macromoleculas
Universidade Federal do Rio de Janeiro (UFRJ) - Brasil
email: jlapham(at)gandalf(dot)bioqmed(dot)ufrj(dot)br
***-*--*----*-------*------------*--------------------*---------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2000-09-01 16:07:35 Re: Query-ing arrays
Previous Message Andreas Tille 2000-09-01 12:44:48 Re: RE: Create table in functions