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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Date: 2011-04-14 18:54:39
Message-ID: BANLkTin1K_NXfa2ZK96i=5ZX5XEerOmkTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 14, 2011 at 11:37 AM, Dimitri Fontaine
<dimitri(at)2ndquadrant(dot)fr> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> rhaas=# CREATE OR REPLACE FUNCTION developer_lookup(id integer)
>> RETURNS text AS $$SELECT name FROM developer WHERE id = $1$$ LANGUAGE
>> sql STABLE;
>>
>> Now, when this person attempts to recreate this function on a
>> hypothetical version of PostgreSQL that thinks "id" is ambiguous, it
>> doesn't work.
>
> Unless we make it so that no such version ever exists.  Meaning that the
> code works fine as is or using WHERE id = developer_lookup.id.  AS id
> can't ever be the parameter in this case, you're just fine.
>
> Bearing in mind that $1 etc shortcuts still are available, I don't
> really see this qualification of parameter names with function names so
> big a problem that we should find a way to avoid it and risk breaking
> compatibility.
>
> Don't forget that any ambiguity here will mean *huge* migration costs.

If I'm reading your email correctly, we're in agreement.

--
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 Heikki Linnakangas 2011-04-14 19:36:09 Re: Single client performance on trivial SELECTs
Previous Message Robert Haas 2011-04-14 18:50:03 Re: proposal: a validator for configuration files