Re: mixed, named notation support

From: Steve Prentice <prentice(at)cisco(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: mixed, named notation support
Date: 2009-08-03 14:46:09
Message-ID: 9BCF79DE-8746-4C93-96B6-2A943FDDD023@cisco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Aug 3, 2009, at 1:41 AM, Pavel Stehule wrote:

> I should to wait with Steve patch - I would to add main sql parser
> into plpgsql - than Steve's patch is unnecessary. But if there will be
> some problems, then we can use Steve's patch. It is simple - so there
> are not big problems with commit.

I was hoping we could get the small patch into plpgsql during this
commitfest. This makes plpgsql recognize 'AS' and not replace named
parameter labels with the variable reference. I understand there is an
effort underway to redo the plpgsql parser, but getting these two
patches in together will allow people to start playing with plpgsql +
named parameters at the end the of commitfest when the first alpha is
released. (You can use named parameters + plpgsql without this patch,
but not without some pretty serious limitations.)

Without this patch, this will fail:

create function create_user(alias text, display_name text) returns
void as $$
BEGIN
perform create_alias(alias AS alias);
...
END
$$ language plpgsql;

This is a common pattern for many of the stored procedures we are
porting and I'd imagine it's common elsewhere too. If the plpgsql
parser patch lands, this patch won't be needed, but it's hard to
predict when it will land.

As an aside, this pattern really shows how confusing the AS syntax can
be for named parameters. Which side is the label and which is the value?

Thanks,
-Steve

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-08-03 14:51:55 Re: mixed, named notation support
Previous Message Tatsuo Ishii 2009-08-03 14:44:56 Re: CVS Head parser error?