Re: plpgsql + named parameters

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Steve Prentice <prentice(at)cisco(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: plpgsql + named parameters
Date: 2009-05-20 17:24:35
Message-ID: 162867790905201024h7473cbd4x5d591c057b4c58e1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/5/20 Steve Prentice <prentice(at)cisco(dot)com>:
>        t := fun1(1 as a);      -- syntax error: "SELECT  fun1(1 as  $1 )"
>
>        t := fun1(a as a);      -- syntax error: "SELECT  fun1( $1  as  $1 )"
>
> On May 19, 2009, at 6:42 PM, Merlin Moncure wrote:
>
> you have a name conflict here...is it deliberate? I've learned the
> hard way to always, always prefix arguments and locals to plpgsql
> functions with '_'.  Or are you trying to do something fancier?
>
> The conflict is deliberate to illustrate the limitations the named parameter
> feature (on the list for the first 8.5 CommitFest) is going to have if
> parameter substitution is not addressed at the same time.
> -Steve

this problem is little bit deeper and is related to plpgsql method for
SQL query processing.

I thing so there are two solutions:

a) use dynamic SQL
b) use double quotes for identifier - identifiers have to be lower

t := fun1(a as "a");

regards
Pavel Stehule

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-05-20 18:51:09 Feedback on writing extensible modules
Previous Message Steve Prentice 2009-05-20 16:57:44 Re: plpgsql + named parameters