]> granicus.if.org Git - postgresql/commit
Get rid of "lookahead" functionality in plpgsql's yylex() function,
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Aug 2006 00:46:59 +0000 (00:46 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Aug 2006 00:46:59 +0000 (00:46 +0000)
commit7ed55aac1c5db3f15e8cd508fc088f8964e7167e
treed71fc87c16b998073ed38e075357de0ae0968449
parente4596d8e60a0f07ba295b9b41808ce8e775af6c1
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.
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/scan.l