Skip site navigation (1) Skip section navigation (2)

Array as parameter for plpgsql function

From: David Pratt <fairwinds(at)eastlink(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Array as parameter for plpgsql function
Date: 2005-07-13 12:00:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
How does one pass an array as a parameter to a plpgsql function?  I 
have tried this the following. I can't seem to get a select statement 
to work without syntax problems and no examples in Postgres book to 
help with this :(  This is just a test so please ignore the fact it is 
a simple function.

CREATE FUNCTION create_record_test(text[][]) RETURNS int4 AS '

	test_array ALIAS FOR $1;      -- alias for input array	
		return array_upper(test_array,1)
' LANGUAGE 'plpgsql';

SELECT create_record_test(ARRAY[ARRAY['A','test one'],ARRAY['B','test 
two']]) AS output;

In response to


pgsql-general by date

Next:From: Einar IndridasonDate: 2005-07-13 12:09:37
Subject: Strange memory behaviour with PGreset() ...
Previous:From: Richard HuxtonDate: 2005-07-13 11:57:31
Subject: Re: 7.4.7: strange planner decision

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group