Re: Use more CppAsString2() in pg_amcheck.c

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-19T01:16:40Z
Lists: pgsql-hackers

Attachments

On Fri, Oct 18, 2024 at 12:22:26PM -0500, Nathan Bossart wrote:
> On Fri, Oct 18, 2024 at 06:50:50PM +0900, Michael Paquier wrote:
>> -	appendPQExpBufferStr(&sql, "\nWHERE c.relpersistence != 't'");
>> +	appendPQExpBufferStr(&sql, "\nWHERE c.relpersistence != "
>> +						 CppAsString2(RELPERSISTENCE_TEMP) " ");
> 
> I think these whitespace changes may cause invalid statements to be
> produced in some code paths.  IMHO those should be reserved for a separate
> patch, anyway.

I may be missing something, of course, but I don't quite see how this
matters for this specific one.  The possible paths after the temporary
persistence check involve a qual on ep.pattern_id, then an addition
based on opts.allrel.  You are right that the extra whitespace after
the RELPERSISTENCE_TEMP bit makes little sense.

Removed that in the v2 attached.
--
Michael

Commits

  1. pg_amcheck: Use CppAsString2() for relkind and relpersistence in queries