Re: Number or parameters for functions - limited to 32 ?

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Number or parameters for functions - limited to 32 ?
Date: 2008-04-08 17:21:56
Message-ID: 47FBA9B4.9000708@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just a FYI, you can get around the 32 param limit in older versions of
postgresql by passing the function a varchar/text array, then use the
built in array functions to pull the "params" from the passed array.

Something like this(not tested code, just a sample):

CREATE or REPLACE FUNCTION test_func(varchar)
RETURNS void AS
$BODY$
DECLARE
IN_ARRAY text[] ;
ACCOUNTNUMBER_IN varchar;
BEGIN

IN_ARRAY = string_to_array($1,'~^~'); --use a unique delimiter

ACCOUNTNUMBER_IN = IN_ARRAY[1];

return;
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

Later,

Tony Caduto
AM Software Design
Home of Lightning Admin for PostgreSQL and MySQL
http://www.amsoftwaredesign.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2008-04-08 17:27:11 Re: Persistent objects within PG or the availability of non-logged tables or databases?
Previous Message Keaton Adams 2008-04-08 17:19:57 Persistent objects within PG or the availability of non-logged tables or databases?