Selecting from arrays - Mailing list pgsql-general

From Simon Drabble
Subject Selecting from arrays
Date
Msg-id Pine.LNX.3.96.990507112714.12605B-100000@dragon
Whole thread Raw
List pgsql-general
Sorry if this has been answered before but a dejanews search turned up
nothing relevant.

I'm trying to select from a table which has a couple of array columns,
and I want to constrain the select on those columns, i.e. something like
(pseudo-code)

select date,loc from results where value appears in temperature

results table:

  date    loc          temperature  (int4[])
12/01/98  4th & Main   {12, 14, 14, 15, 17, 19, 25, ...}
12/04/98  Station 4    {12, 13, 14, 666, 18, 20, 24, ...}

I want to select only those rows where one of the recorded temps is equal to ,
say, 17 , and also to select a range (rows where temp > 20, or where temp <
10). I might also want to select rows where the temp could not be measured
(indicated by 666) at a certain period.


I can do it if I step through each of the temperature values and compare each
one, but this seems needlessly inefficient.

Is there a quick way to retrieve these rows?


Simon.


--
  Caveat lector

   Simon Drabble                      Somewhere in cyberspace
   simond@foxlink.net


pgsql-general by date:

Previous
From: José Soares
Date:
Subject: Re: [GENERAL] int8-datatype: possible bug
Next
From: Palle Girgensohn
Date:
Subject: Re: [GENERAL] Trying using Postgresql on FreeBSD