Re: [SQL] Passing arrays

From: Michael Weaver <mweaver(at)corpusglobe(dot)com>
To: 'Stephan Szabo' <sszabo(at)megazone23(dot)bigpanda(dot)com>, Michael Weaver <mweaver(at)corpusglobe(dot)com>
Cc: "'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 08:09:55
Message-ID: 3B663B41B350D311AEEF00A0C9254563201A72@VISION1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

> -----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.

Thanks.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Durst 2003-02-14 08:57:59 Re: Passing arrays
Previous Message Stephan Szabo 2003-02-14 04:57:33 Re: [SQL] Passing arrays

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-02-14 08:33:22 Re: PL/PGSQL EDITOR
Previous Message Wei Weng 2003-02-14 05:52:41 Re: Extending Datatype