Re: Replacing plpgsql's lexer - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Replacing plpgsql's lexer
Date
Msg-id 19917.1239744771@sss.pgh.pa.us
Whole thread Raw
In response to Re: Replacing plpgsql's lexer  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Robert Haas wrote:
>> All this sounds good.  As for how to handle := and .., I think making
>> them lex the same way in PL/pgsql and core SQL would be a good thing.

> They don't have any significance in core SQL. What would we do with the 
> lexeme?

It would just fail --- the core grammar will have no production that can
accept it.  Right offhand I think the only difference is that instead of

regression=# select a .. 2;
ERROR:  syntax error at or near "."
LINE 1: select a .. 2;                 ^

you'd see 

regression=# select a .. 2;
ERROR:  syntax error at or near ".."
LINE 1: select a .. 2;                ^

ie it acts like one token not two in the error message.

This solution would become problematic if the core grammar ever had a
meaning for := or .. that required treating them as two tokens (eg,
the grammar allowed this sequence with whitespace between).  I don't
think that's very likely though; and if it did happen we could fix it
with the aforementioned control switch.

> The only thing that makes me nervous about this is that we're very close 
> to Beta. OTOH, this is one area the regression suite should give a 
> fairly good workout to.

Yeah, I'd rather have done it before beta1, but too late.  The other
solution still entails massive changes to the plpgsql lexer, so it
doesn't really look like much lower risk.  AFAICS the practical
alternatives are a reimplementation in beta2, or no fix until 8.5.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Replacing plpgsql's lexer
Next
From: Devrim GÜNDÜZ
Date:
Subject: Yet another regression issue with Fedora-10 + PG 8.4 beta1