Re: Fw: Max input parameter for a function

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Kumar" <sgnerd(at)yahoo(dot)com(dot)sg>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Fw: Max input parameter for a function
Date: 2003-10-21 16:33:44
Message-ID: 200310210933.44713.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kumar,

> While trying to allocate about 36 input parameters, I got an error saying
> that the max input parameter for a function is only 32.
>
> Is it right? How to overcome this? Because I wanna insert records into a
> table of 55 columns with a lot of NULL able columns.

First off, if your table has 55 columns and many are nullable, then you have a
database design problem ... your database is not normalized.

Assuming that you can't fix your database, there's two methods you can take:

1) Rather than pushing in all of the columns as parameters, you can dump the
record into a holding table (e.g. mytable_buffer) and then call a procedure
to process the data there.

2) You can re-compile PostgreSQL to accept more parameters. This requires:
1. Backup your database cluster using pg_dumpall. (make sure to
double-check!)
2. Shut down postgresql
3. Delete the PGDATA directory
4. Go into your postgresql source, and edit the file
src/include/pg_config.h , and raise "INDEX_MAX_KEYS" to the desired level,
probably 64. Warning: This may impose a minor performance
penalty on Postgres!
5. Re-compile Postgres, starting with "make clean"
6. Run initdb
7. Restore your database cluster from the pg_dumpall file

--
Josh Berkus
Aglio Database Solutions
San Francisco

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-10-21 16:48:19 Re: Many joins: monthly summaries S-L--O--W
Previous Message Wilhelm Graiss 2003-10-21 13:58:20 plpgsql related question: intervals and variables