Re: CASE control block broken by a single line comment
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Wienhold <ewie@ewie.name>
Cc: Michal Bartak <maxym.srpl@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-04-07T04:33:12Z
Lists: pgsql-hackers
Erik Wienhold <ewie@ewie.name> writes: > On 2024-04-06 20:14 +0200, Michal Bartak wrote: >> The issue described bellow exists in postgresql ver 16.2 (found in some >> previous major versions) > Can confirm also on master. I'm sure it's been there a while :-( > I'm surprised that the comment is not skipped by the scanner at this > point. Maybe because the parser just reads the raw expression between > WHEN and THEN with plpgsql_append_source_text via read_sql_construct. > How about the attached patch? It's a workaround by simply adding a line > feed character between the raw expression and the closing parenthesis. I don't have time to look into this on this deadline weekend, but what's bothering me about this report is the worry that we've made the same mistake elsewhere, or will do so in future. I suspect it'd be much more robust if we could remove the comment from the expr->query string. No idea how hard that is. regards, tom lane
Commits
-
Fix plpgsql's handling of -- comments following expressions.
- f5cee411a190 13.15 landed
- dc5824a06e97 14.12 landed
- d85db0a8e95c 15.7 landed
- 5e9d8bed0094 12.19 landed
- 5392dd3d2ad5 17.0 landed
- 48f216dc634b 16.3 landed