Re: named parameters in SQL functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: named parameters in SQL functions
Date: 2009-11-16 02:39:23
Message-ID: 29400.1258339163@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Chernow <ac(at)esilo(dot)com> writes:
> Tom Lane wrote:
>> It's certainly true that the function name itself is not immune from
>> conflicts of that sort ... in fact I think we saw a bug report recently
>> from someone who had intentionally chosen a plpgsql function name equal
>> to a table name used in the function :-(. So I'm not wedded to the
>> function name entirely. But it has precedent in plpgsql, and that
>> precedent came from Oracle, so I don't think we should lightly make SQL
>> functions do something different.

> If the concern is portability, (ANYTHING).name won't work. You would have to
> stick with function.name or support both styles.

I find the recent SQL drafts pretty darn opaque, but I think that
SQL:2008 6.6 <identifier chain> syntax rule 8)b)ii)

If N = 2 and PIC1 is equivalent to the <qualified identifier> of
a <routine name> RN whose scope contains IC and whose associated <SQL
parameter declaration list> includes an SQL parameter SP whose <SQL
parameter name> is equivalent to I2, then PIC2 is a candidate basis of
IC, the scope of PIC2 is the scope of SP, and the referent of PIC2 is
SP.

is describing the style "function_name.argument_name". So it's not just
Oracle setting that precedent.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-11-16 02:41:02 Re: named parameters in SQL functions
Previous Message Andrew Gierth 2009-11-16 02:29:28 Re: Aggregate ORDER BY patch