Re: get_fn_expr_variadic considered harmful

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: get_fn_expr_variadic considered harmful
Date: 2014-04-03 23:17:44
Message-ID: 17393.1396567064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Well, that argues for the choice of trying to make them equivalent
>> again, I suppose, but it sounds like there are some nasty edge cases
>> that won't easily be filed down. I think your idea of redefining
>> funcvariadic to be true only for VARIADIC ANY is probably a promising
>> approach to that solution, but as you say it leaves some problems
>> unsolved.

> I think what we'll have to do is tell complainants to recreate any
> affected indexes or rules after installing 9.3.5. Given the relatively
> small number of complaints, I don't think it's worth working harder,
> nor taking risks like inserting catalog lookups into readfuncs.c.

After some thought, it seems to me that the best solution is to redefine
funcvariadic as meaning "the last actual argument is a variadic array",
which means it will always be true for a VARIADIC non-ANY function.
In HEAD, that leads to a nice patch that actually simplifies the logic
in ruleutils.c, as attached. In 9.3, we will not be able to assume that
funcvariadic has that meaning, so we'll have to use the existing
decompilation logic (which basically ignores funcvariadic unless it's a
VARIADIC ANY function). I've not made that version of the patch yet but
it should be pretty straightforward.

regards, tom lane

Attachment Content-Type Size
variadic-fix-for-head-only.patch text/x-diff 11.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-04-03 23:23:47 Re: WAL format and API changes (9.5)
Previous Message Tom Lane 2014-04-03 23:08:27 Re: WAL format and API changes (9.5)