Re: WIP: Allow SQL-language functions to reference parameters by parameter name - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Date
Msg-id 15539.1301082904@sss.pgh.pa.us
Whole thread Raw
In response to WIP: Allow SQL-language functions to reference parameters by parameter name  (Matthew Draper <matthew@trebex.net>)
Responses Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Re: WIP: Allow SQL-language functions to reference parameters by parameter name
List pgsql-hackers
Matthew Draper <matthew@trebex.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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Set hint bits upon eviction from BufMgr
Next
From: Tom Lane
Date:
Subject: Re: When and how many times does ExecSetParamPlan executes?