public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: [email protected]
Subject: pgsql: Fix accidentally-harmless thinko in psqlscan_test_variable().
Date: Mon, 31 Mar 2025 16:16:44 +0000
Message-ID: <[email protected]> (raw)

Fix accidentally-harmless thinko in psqlscan_test_variable().

This code was passing literal strings to psqlscan_emit,
which is quite contrary to that function's specification:
"If you pass it something that is not part of the yytext
string, you are making a mistake".  It accidentally worked
anyway, even in non-safe_encoding mode.  psqlscan_emit
would compute a garbage "reference" pointer, but would
never dereference that since the passed string is all-ASCII.
So there's no live bug today, but that is a happenstance
outcome of psqlscan_emit's current implementation.

Let's make psqlscan_test_variable do what it's supposed to,
namely append directly to the output buffer.  This is just
future-proofing against possible changes in psqlscan_emit,
so I don't feel a need to back-patch.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2fd3e2fa5c908d05ac4d8b6c2c80fd50c506f32e

Modified Files
--------------
src/fe_utils/psqlscan.l | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



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]
  Subject: Re: pgsql: Fix accidentally-harmless thinko in psqlscan_test_variable().
  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