Re: get_fn_expr_variadic considered harmful

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: get_fn_expr_variadic considered harmful
Date: 2014-04-01 18:03:41
Message-ID: CA+TgmoYem8zAXwKmwcUr8NVe5hjdZmS6xJA4jF-SmPkXxVy=EA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 1, 2014 at 12:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> In bug #9817 there's a complaint that the planner fails to consider
> these expressions equivalent:
> foo('a'::text, 'b'::text)
> foo(variadic array['a'::text, 'b'::text])
> when foo() is declared as taking variadic text[].

My first reaction to this was "who cares? after all, the user should
just write the expression the same way both times and then they won't
have this problem". But after going and looking at the bug report I
see that the user wrote it the first way consistently, but pg_dump
blithely rewrote it to the second way. I'm disinclined to view that
as a planner problem; it seems to me to be a pg_dump or ruleutils bug.
If those two things don't have the same parse representation, then
pg_dump has no business treating them as equivalent - even if we were
to put enough smarts into the planner to paper over that
non-equivalence.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-04-01 18:04:47 Re: Doing better at HINTing an appropriate column within errorMissingColumn()
Previous Message Andres Freund 2014-04-01 17:58:22 Re: GSoC proposal - "make an unlogged table logged"