Re: Replacing plpgsql's lexer

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Replacing plpgsql's lexer
Date: 2009-04-14 21:32:51
Message-ID: 19917.1239744771@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2009-04-14 21:34:17 Yet another regression issue with Fedora-10 + PG 8.4 beta1
Previous Message Andrew Dunstan 2009-04-14 21:07:49 Re: Replacing plpgsql's lexer