pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Curtis Scheer <Curtis@DAYCOS.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to pass array of values to a stored procedure
Date: Tue, 18 Jul 2006 13:15:28 -0400
Message-ID: <5376.1153242928@sss.pgh.pa.us> (raw)
In-Reply-To: <031936836C46D611BB1B00508BE7345D048DAAB8@gatekeeper.daycos.com>
References: <031936836C46D611BB1B00508BE7345D048DAAB8@gatekeeper.daycos.com>

Curtis Scheer <Curtis@DAYCOS.com> writes:
> Does anyone have any examples of how I would make a stored procedure in
> plpgsql that would allow for passing a list or arrays of values to be used
> in an sql IN clause?  Like so: select * from table where field1 in (values).

Probably the "field1 = ANY (arrayvalue)" syntax is what you want.  Note
however that this can't be turned into an indexscan on field1 in existing
releases (8.2 will be able to do it).

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <5376.1153242928@sss.pgh.pa.us>
Permalink:  ../5376.1153242928@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5376.1153242928@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Curtis@DAYCOS.com
  Subject: Re: How to pass array of values to a stored procedure
  In-Reply-To: <5376.1153242928@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox