Re: [PATCH] 8.5 plpgsql change for named notation: treat word following AS keyword as label v2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Prentice <prentice(at)cisco(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] 8.5 plpgsql change for named notation: treat word following AS keyword as label v2
Date: 2009-05-21 17:52:59
Message-ID: 12752.1242928379@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Steve Prentice <prentice(at)cisco(dot)com> writes:
> This patch is intended to supplement Pavel's patch for named and mixed
> notation support in 8.5. This patch makes it so a plpgsql function can
> call another function with the same parameter names using the named
> parameters notation.

Well, plpgsql's parsing has always been a kluge, but I think this is
really taking the kluge level a step too far. It's only because AS
is used in so few contexts that this can even pretend to work --- but
there are still an awful lot of contexts where AS is used, and will
likely be more in the future. So I think it's pretty un-future-proof;
and it certainly won't scale to any other contexts where we might wish
that plpsql variables don't get substituted.

It's probably time to bite the bullet and redo the parser as has been
suggested in the past, ie fix things so that the main parser is used.
Ideally I'd like to switch the name resolution priority to be more
Oracle-like, but even if we don't do that it would be a great
improvement to have actual syntactic knowledge behind the lookups.

Just for the record, you'd have to put the same kluge into the T_RECORD
and T_ROW cases if we wanted to do it like this.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-05-21 18:07:07 Re: Fast ALTER TABLE ... ADD COLUMN ... DEFAULT xxx?
Previous Message Steve Prentice 2009-05-21 17:31:55 [PATCH] 8.5 plpgsql change for named notation: treat word following AS keyword as label v2