public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Erik Wienhold <[email protected]>
Cc: Michal Bartak <[email protected]>
Cc: [email protected]
Subject: Re: CASE control block broken by a single line comment
Date: Sun, 07 Apr 2024 00:33:12 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <utvbxgxkzflf2tn73iejt3qn4devu3f3kbhqvwxm6qkeboe7wf@mg4gzyufd547>
References: <CAAVzF_FjRoi8fOVuLCZhQJx6HATQ7MKm=aFOHWZODFnLmjX-xA@mail.gmail.com>
	<utvbxgxkzflf2tn73iejt3qn4devu3f3kbhqvwxm6qkeboe7wf@mg4gzyufd547>

Erik Wienhold <[email protected]> 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






view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: CASE control block broken by a single line comment
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox