Re: V0.1 patch for TODO Item: SQL-language reference parameters by name.

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: V0.1 patch for TODO Item: SQL-language reference parameters by name.
Date: 2007-11-02 17:24:53
Message-ID: 162867790711021024m2479bc25le6096a8bc2e182de@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On 02/11/2007, Gevik Babakhani <pgdev(at)xs4all(dot)nl> wrote:
>
> Hi,
>
> > what about name's collision? Maybe is better use some prefix,
> > like $ or :. Without it we only propagate one problem from
> > plpgsql to others languages.
> >
> Please explain.
>
> Perhaps I am wrong, but plpgsql handles arsgument names before it
> passes the query to be executed. Please see:
>
> plpgsql/pl_comp.c/do_compile(...)/line: 393
>
> Regards,
> Gevik.
>

it's one from mystic bugs:

create table t(a integer, b integer);
insert into t values(10,20);

create function foo(a integer)
returns integer
as $$
select a from t
where a <> b and a = 10;
$$ languge sql;

select foo(20);
output? expected 10, but you will get NULL!

Regards
Pavel Stehule

so some prefixes can help

create function foo(a integer)
returns integer
as $$
select a from t
where :a <> b and a = 10;
$$ languge sql;

Oracle use symbol ':'

I don't know what others databases has.

Regards
Pavel Stehule

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ohp 2007-11-02 17:26:35 should I worry?
Previous Message bruno.gaudin 2007-11-02 17:24:18 Re: beta2, I can't set UTF-8 for czech locales on win

Browse pgsql-patches by date

  From Date Subject
Next Message Henry B. Hotz 2007-11-02 18:23:30 Re: krb_match_realm
Previous Message Tom Lane 2007-11-02 16:17:04 Re: V0.1 patch for TODO Item: SQL-language reference parameters by name.