Re: [GENERAL] Many Pl/PgSQL parameters -> AllocSetAlloc(128)?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: reuven(at)lerner(dot)co(dot)il, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [GENERAL] Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Date: 2003-06-25 18:35:20
Message-ID: 7789.1056566120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> writes:
> The above didn't work, but if I understand correctly what that function
> is intended to do, it seemed very broken. Basically this code:
> nanswers = 1;
> for (i = 0; i < nargs; i++)
> {
> nanswers *= (arginh[i].nsupers + 2);
> cur[i] = 0;
> }
> for 24 arguments means 2^24 answers, even when there are no superclasses.

Right, but it should be (arginh[i].nsupers + 1) at each position. It's
not quite as broken as you think.

What the code is trying to do is consider superclasses as substitute
argument types at each position where there is a complex type. But it
should consider that in combination with both original argument types
and superclasses at each other position. Your proposed patch is like
asserting that *all* argument positions must be promoted if any are.

The part I think we want to get rid of is the insertion of zero as an
additional considered possibility at each position. That's certainly
not appropriate any longer for scalar types, and I don't think it is
appropriate for complex types either, in view of the fact that we got
rid of OPAQUE as a wildcard type in 7.3.

I'll put in a patch this afternoon. And try to improve the comments
while I'm at it ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message AgentM 2003-06-25 18:48:49 Re: [GENERAL] Physical Database Configuration
Previous Message Reuben D. Budiardja 2003-06-25 18:06:57 INSERT WHERE NOT EXISTS

Browse pgsql-hackers by date

  From Date Subject
Next Message AgentM 2003-06-25 18:48:49 Re: [GENERAL] Physical Database Configuration
Previous Message Michael Meskes 2003-06-25 17:56:13 Re: still getting ecpg compile failures

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-06-25 20:11:30 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Previous Message Nabil Sayegh 2003-06-25 18:24:59 Re: autotimestamping