By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

Is the use of array as PL/PGSQL function arguments ?

P: n/a

Hello,

Since it's not possible to do a function with a variable number of arguments, I am wondering if it is possible to use an array as an argument in a PL/PGSQL function ?

CREATE OR REPLACE FUNCTION myownfunction(members.id%TYPE[], events.id%TYPE) RETURNS BOOLEAN AS '
BEGIN
...several sql queries that are OK...
RETURN TRUE;
END;
' LANGUAGE 'plpgsql';

I am currently getting this error : ERROR: parser: parse error at or near "["

But I don't see anything in the documentation that forbids the use of array as arguments. So, did I make a mistake or is it forbidden ?

Thanks in advance :-)

---------------------------------------
Bruno BAGUETTE (pg******@baguette.net)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
pg******@baguette.net writes:
Since it's not possible to do a function with a variable number of arguments, I am wondering if it is possible to use an array as an argument in a PL/PGSQL function ? CREATE OR REPLACE FUNCTION myownfunction(members.id%TYPE[], events.id%TYPE) RETURNS BOOLEAN AS '


You can certainly use arrays as arguments, but I don't think you can
combine %TYPE with [] like that.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.