From: | "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com> |
---|---|
To: | "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Henrique P Machado" <zehrique(at)gmail(dot)com>, "Guy Rouillier" <guyr-ml1(at)burntmail(dot)com>, pgsql-general(at)postgresql(dot)org, "Sandip G" <sandip(at)singapore(dot)com> |
Subject: | Re: NEED URGENT HELP.... |
Date: | 2006-12-26 15:09:01 |
Message-ID: | 65937bea0612260709s6a4e0d16v375d401564569f22@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-general pgsql-sql |
It works Martijn...
but with a few changes will be required in your function Sandip; you will
have to pass an ARRAY constructor and return a SETOF record. Here's a
sample:
postgres=> create table tab ( a int, b int );
CREATE TABLE
postgres=> insert into tab values ( 1, 9 );
INSERT 0 1
postgres=> insert into tab values (2,8);
INSERT 0 1
postgres=> insert into tab values (3,7);
INSERT 0 1
postgres=> insert into tab values (4,6);
INSERT 0 1
postgres=> insert into tab values (5,5);
INSERT 0 1
postgres=> create or replace function fun ( character varying [] ) returns
setof
tab as
postgres-> $$
postgres$> select * from tab where a = any ($1)
postgres$> $$ language 'sql' volatile;
CREATE FUNCTION
postgres=> select fun('{1}');
fun
-------
(1,9)
(1 row)
postgres=> select fun('{2,3}');
fun
-------
(2,8)
(3,7)
(2 rows)
postgres=>
Hope it helps....
On 12/26/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
>
> On Mon, Dec 25, 2006 at 08:52:52PM -0300, Henrique P Machado wrote:
> > WHERE (USER_ID = $1) AND (COMPANY_ID = $2) AND BOOK_NO IN ($3)
> >
> > Could'nt he use an array in this 3rd parameter?
>
> I think so, if it's written:
>
> AND BOOK_NO = ANY($3)
>
> Have a nice day,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > From each according to his ability. To each according to his ability to
> litigate.
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFFkQ1LIB7bNG8LQkwRApbCAJsH26IcDusO5Vi5kNC1UQ185usbnACeOxdC
> xQo+z5Z7+Xofks/h3MmeF7w=
> =Rq6g
> -----END PGP SIGNATURE-----
>
>
>
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | yahoo }.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-12-26 16:57:46 | Re: BUG #2836: SPI_execute_plan failed on pl/pgsql function that worked on 8.1 |
Previous Message | Martijn van Oosterhout | 2006-12-26 11:53:48 | Re: NEED URGENT HELP.... |
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Dale | 2006-12-26 15:11:43 | Re: Clustering & Load Balancing & Replication |
Previous Message | Tom Lane | 2006-12-26 15:08:17 | Re: Does pgsql's regex processor optimize Common-Prefix? |
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Meyland Andersen | 2006-12-26 20:10:37 | Re: Related tables to a view |
Previous Message | Martijn van Oosterhout | 2006-12-26 11:53:48 | Re: NEED URGENT HELP.... |