Re:

From: Matthew Peter <survivedsushi(at)yahoo(dot)com>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re:
Date: 2006-01-09 23:26:45
Message-ID: 20060109232645.78285.qmail@web35211.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How come when I pass in a list in it doesn't use it as a list of integers? Do I need to somehow make $1 be interpreted as a list of ints? Rather than just passing a text value that contains the list?

CREATE TABLE my_tbl (u_id int);

INSERT INTO my_tbl (u_id) values (1);
INSERT INTO my_tbl (u_id) values (2);
INSERT INTO my_tbl (u_id) values (3);

CREATE OR REPLACE FUNCTION getlist(text) RETURNS SETOF my_tbl as $$
SELECT * FROM my_tbl
WHERE u_id IN (0, $1);

$$ LANGUAGE SQL;

SELECT * from getlist('1,2,3');
(0 rows)

I'm sure it's probably trival but I'm still learning how psql :) Thanks


---------------------------------
Yahoo! Photos
Got holiday prints? See all the ways to get quality prints in your hands ASAP.

In response to

  • Re: at 2006-01-09 22:14:22 from Jaime Casanova

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2006-01-09 23:38:40 Re: autocommit to off
Previous Message Jaime Casanova 2006-01-09 22:14:22 Re: