Arrays advanced usage

Started by Florent Guillaumeabout 25 years ago2 messagesgeneral
Jump to latest
#1Florent Guillaume
florent.guillaume@mail.com

I just discoverred arrays, and I'm wondering if there's a way to do,
given table t1 (v int4, a int4[]), a query that does in effect :
"select v, i from t1 where EXISTS i SUCHTHAT a[i] = 45;"

I know I can do it with a separate table and a join, but this would
be much nicer.

Also, I wanted to mention that no "reference" is pointed directly from
http://www.postgresql.org/devel-corner/docs/index.html
(you have to go through "postgres" to find it, I think it's not very
intuitive).

Florent

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Florent Guillaume (#1)
Re: Arrays advanced usage

On Fri, 19 Jan 2001, Florent Guillaume wrote:

I just discoverred arrays, and I'm wondering if there's a way to do,
given table t1 (v int4, a int4[]), a query that does in effect :
"select v, i from t1 where EXISTS i SUCHTHAT a[i] = 45;"

I know I can do it with a separate table and a join, but this would
be much nicer.

Check out the code in contrib/array which provides extra
functions/operators for various common array types.