Re: [SQL] Passing arrays

From: Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: Michael Weaver <mweaver(at)corpusglobe(dot)com>
Cc: "'Stephan Szabo'" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>, "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] Passing arrays
Date: 2003-02-14 12:10:09
Message-ID: Pine.LNX.4.44.0302141007300.16950-100000@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

On Fri, 14 Feb 2003, Michael Weaver wrote:

>
>
> > -----Original Message-----
> > From: Stephan Szabo [mailto:sszabo(at)megazone23(dot)bigpanda(dot)com]
> > Sent: Friday, 14 February 2003 12:58 PM
> > To: Michael Weaver
> > Cc: 'pgsql-novice(at)postgresql(dot)org'; 'pgsql-sql(at)postgresql(dot)org'
> > Subject: Re: [SQL] Passing arrays
> >
> >
> >
> > On Fri, 14 Feb 2003, Michael Weaver wrote:
> >
> > > How do you get an array of elements to be passed to a
> > stored proc such that
> > > you can use the array in a SELECT statement in the WHERE clause
> > > - e.g. WHERE field IN (array) etc...
> >
> > A straight WHERE field IN (array) doesn't work. That's attempting to
> > compare the field directly to the array as a whole (which is
> > why you get
> > the particular error you do.
>
> I've got around this limitation using strings, but I do find it suprising,
> that Postgres handles arrays this way.
> Searching an array in an WHERE IN clause would be a useful task. (namely for
> passing arrays of values between stored functions)
>
> Ok it could be confusing, but I think a number of other DBs employ it to
> good effect.
>
> I'll take a look at the array extension in contrib - it sounds useful.

Also check out contrib/intarray and its indexing capabilites
if you have 1 dimensional integer arrays.

>
> Thanks.
>

==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Achilleus Mantzios 2003-02-14 13:17:31 Re: Passing arrays
Previous Message Andres Ledesma 2003-02-14 09:43:02 Re: Generating the db script file ....

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-02-14 12:24:45 Re: sub-query optimization
Previous Message Gary Stainburn 2003-02-14 12:02:18 Re: Table Pivot