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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Matthew Draper <matthew(at)trebex(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Date: 2011-03-25 20:08:24
Message-ID: AANLkTi=ZTAfGSVN+4X+b8SW7Zbu7CRb3DXsucm3-OWWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/3/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Matthew Draper <matthew(at)trebex(dot)net> writes:
>> Attached is a WIP patch that allows SQL-language functions to reference
>> their parameters by name.
>
>> It uses p_post_columnref_hook, so potentially ambiguous references
>> prefer the column... that seems to make the most sense, both because it
>> avoids a backwards incompatibility, and it conforms with SQL's usual
>> notion of assuming you mean the "nearest" name.
>
> Personally I'd vote for *not* having any such dangerous semantics as
> that.  We should have learned better by now from plpgsql experience.
> I think the best idea is to throw error for ambiguous references,
> period.  That means you do need ways to disambiguate in both directions.
> For column references you can just qualify with the table name/alias.
> If the parameter reference is intended, allow qualification with the
> function name.

I agree with Tom.

There can be GUC for controlling use or don't use a parameter names. I
am for GUC, because there will be a bilion conflicts. But a talk about
priorities - sql identifier or parameter is useless.

Regards

Pavel Stehule

>
>                        regards, tom lane
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-03-25 20:18:00 Re: Set hint bits upon eviction from BufMgr
Previous Message Tom Lane 2011-03-25 20:06:30 Re: SSI bug?