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

From Tom Lane
Subject Re: [GENERAL] Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Date
Msg-id 7789.1056566120@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Many Pl/PgSQL parameters -> AllocSetAlloc(128)?  (Joe Conway <mail@joeconway.com>)
List pgsql-patches
Joe Conway <mail@joeconway.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

pgsql-patches by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Runtime.SGML diff ... please expedite!
Next
From: Bruce Momjian
Date:
Subject: Re: Runtime.SGML diff ... please expedite!