From: | tgl(at)postgresql(dot)org (Tom Lane) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Get rid of "lookahead" functionality in plpgsql's yylex() |
Date: | 2006-08-14 00:46:59 |
Message-ID: | 20060814004659.6076F9FB2E6@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Log Message:
-----------
Get rid of "lookahead" functionality in plpgsql's yylex() function,
and instead make the grammar production for the RETURN statement do the
heavy lifting. The lookahead idea was copied from the main parser, but
it does not work in plpgsql's parser because here gram.y looks explicitly
at the scanner's yytext variable, which will be out of sync after a
failed lookahead step. A minimal example is
create or replace function foo() returns void language plpgsql as '
begin
perform return foo bar;
end';
which can be seen by testing to deliver "foo foo bar" to the main parser
instead of the expected "return foo bar". This isn't a huge bug since
RETURN is not found in the main grammar, but it could bite someone who
tried to use "return" as an identifier.
Back-patch to 8.1. Bug exists further back, but HEAD patch doesn't apply
cleanly, and given the lack of field complaints it doesn't seem worth
the effort to develop adjusted patches.
Tags:
----
REL8_1_STABLE
Modified Files:
--------------
pgsql/src/pl/plpgsql/src:
gram.y (r1.82.2.1 -> r1.82.2.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/gram.y.diff?r1=1.82.2.1&r2=1.82.2.2)
scan.l (r1.42 -> r1.42.2.1)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/scan.l.diff?r1=1.42&r2=1.42.2.1)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-08-14 02:27:27 | pgsql: Revert (again) GUC patch to return commented fields to their |
Previous Message | Tom Lane | 2006-08-14 00:46:53 | pgsql: Get rid of "lookahead" functionality in plpgsql's yylex() |