Forum OpenACS Q&A: Re: How to insert more than 16 values into a table of postgresql, using functions

Like I told you in a previous thread, you can change the maximum number of arguments when compiling PostgreSQL. Search for 'FUNCTION_MAX_ARGS' in in your postgres source folder under src/include/. If I remember correct, PG7.3 doesn't have this restriction anymore, but it might be a misconception.

If you're not able to recompile, you can maybe use two different plpgsql functions and call them both from a single tcl proc. You'd then do the insert in the first function and return the key of the row. In the second function you'd then modify the row using the key you just got. Don't know if this is the best way (or a good idea at all), though, just one possible solution.

Hi Jarkko Laine,
    I will try to do the first solution i.e changing the config file. Is it available with PostGreSQL 7.2.4 version, as i am using this as my database.
    One more doubt about the second solution that how to get the "key" of the row from the function i tried with the ACS API called as db_exec_plsql but i could not able to get the return value from the function after the execution of function xxx_new. Can u plz tell me how to do this in a small sample way.

  I once thank you for your answere, hoping to get solution from you in a early way.


Venu Madhav Deevi

Yes, the file should be there. Just check.

The difference between function and procedure in plpgsql is that a function has a return value. If you say "select plpgsql_func(...)" in db_exec_plsql block, you will get the key, as long as the plpgsql function returns the appropiate key.

You can even use sequence pooling and db_nextval to get the key so you don't even have to grab the value from plpgsql. See OpenACS DB Access API Guide for this.


set key [db_nextval yoursequence]

db_exec_plsql procname "select procname($key, ...(other attributes)...)"
db_exec_plsql proc2name "select proc2name($key, ...(rest of the attributes)...)"
Hope this helps.