Thread: Stored procedures

Stored procedures

From
"Yolanda Phillips"
Date:
Good day,

I need help URGENTLY!!

I'm trying to compile a Stored Function that performs either an insert or an
update on a table. The function has 44 input parameters and returns an
integer. When compiling the function a get an error:

ERROR: functions cannot have more than 32 arguments

I would just like someone to confirm this. Can a function only have 32 input
parameters? If so, I'd have to use Prepared Statements then.

Thank you in advance.



Sincerely,


Yolanda Phillips
Web Applications Developer



Attachment

Re: Stored procedures

From
Robert Treat
Date:
Yes, this is correct. You can increase the limit by recompiling, though
there a believed to be some performance issues associated with choosing
a limit higher than 32. search the mail archives for the specifics of
where you need to do this in the code.

Robert Treat

On Fri, 2003-10-03 at 01:47, Yolanda Phillips wrote:
> Good day,
>
> I need help URGENTLY!!
>
> I'm trying to compile a Stored Function that performs either an insert
> or an
> update on a table. The function has 44 input parameters and returns an
> integer. When compiling the function a get an error:
>
> ERROR: functions cannot have more than 32 arguments
>
> I would just like someone to confirm this. Can a function only have 32
> input
> parameters? If so, I'd have to use Prepared Statements then.
>
> Thank you in advance.
>
>
>
> Sincerely,
>
>
> Yolanda Phillips
> Web Applications Developer
>
>
>
> ----
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL


Re: Stored procedures

From
"scott.marlowe"
Date:
On Fri, 3 Oct 2003, Yolanda Phillips wrote:

> Good day,
>
> I need help URGENTLY!!
>
> I'm trying to compile a Stored Function that performs either an insert or an
> update on a table. The function has 44 input parameters and returns an
> integer. When compiling the function a get an error:
>
> ERROR: functions cannot have more than 32 arguments
>
> I would just like someone to confirm this. Can a function only have 32 input
> parameters? If so, I'd have to use Prepared Statements then.

The 32 arg limit is a compile time / reinitdb parameter.  I.e. you can
change it, but you'll have to first pg_dumpall your database, recompile
postgresql with a different limit, and then restore your database to get
more than 32 args.

But there are other ways around it, like passing a record type or array to
the function.