Re: CASE control block broken by a single line comment

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michal Bartak <maxym(dot)srpl(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: CASE control block broken by a single line comment
Date: 2024-04-12 20:15:08
Message-ID: 32m73i437tpy3nvxp6i6mai2xjfd2jym22kfp6nyf7eh5nejmp@rpons2jwdkz6
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-04-09 00:54 +0200, Tom Lane wrote:
> I poked at this and found that the failures occur when the patched
> code decides to trim an expression like "_r.v" to just "_r", naturally
> breaking the semantics completely. That happens because when
> plpgsql_yylex recognizes a compound token, it doesn't bother to
> adjust the token length to include the additional word(s).

Thanks Tom! I haven't had the time to look at your patch.

I'm surprised that the lexer handles compound tokens. I'd expect to
find that in the parser, especially because of using the context-aware
plpgsql_ns_lookup to determine if we have a T_DATUM or T_{WORD,CWORD}.

Is this done by the lexer to allow push-back of those compound tokens
and maybe even to also simplify some parser rules?

--
Erik

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-04-12 20:55:16 Re: Typos in the code and README
Previous Message Dmitry Koval 2024-04-12 19:59:57 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands