Re: WIP: Allow SQL-language functions to reference parameters by parameter name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Matthew Draper <matthew(at)trebex(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Date: 2011-04-08 16:11:37
Message-ID: 13699.1302279097@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Thu, Apr 7, 2011 at 8:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Well, if we're going to consider 100% backwards compatibility a "must",
>> then we should just stick with what the submitted patch does, ie,
>> unqualified names are matched first to query columns, and to parameters
>> only if there's no column match. This is also per spec if I interpreted
>> Peter's comments correctly. The whole thread started because I
>> suggested that throwing an error for ambiguous cases might be a better
>> design in the long run, but apparently long term ease of code
>> maintenance is far down our list of priorities ...

> +1, as long as you are 100.0% sure this is not going to break any
> existing code. For example, what happens if the argument is named the
> same as a table?

I was a bit sloppy in my statement above --- what the code is actually
doing (or should be doing) is matching to parameters only after the core
parser fails to find any match. So "unqualified reference to whole-row"
would take precedence too.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Muhammad Usama 2011-04-08 16:45:06 getting carriage return character in vacuumo
Previous Message Merlin Moncure 2011-04-08 16:06:09 Re: WIP: Allow SQL-language functions to reference parameters by parameter name