Re: Rename libpq trace internal functions

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rename libpq trace internal functions
Date: 2024-05-02 14:22:49
Message-ID: 1a282635-46a9-4673-aabf-2f7d11f6b7fb@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24.04.24 12:34, Yugo NAGATA wrote:
> On Wed, 24 Apr 2024 09:39:02 +0200
> Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
>> libpq's pqTraceOutputMessage() used to look like this:
>>
>> case 'Z': /* Ready For Query */
>> pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
>> break;
>>
>> Commit f4b54e1ed98 introduced macros for protocol characters, so now
>> it looks like this:
>>
>> case PqMsg_ReadyForQuery:
>> pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
>> break;
>>
>> But this introduced a disconnect between the symbol in the switch case
>> and the function name to be called, so this made the manageability of
>> this file a bit worse.
>>
>> This patch changes the function names to match, so now it looks like
>> this:
>>
>> case PqMsg_ReadyForQuery:
>> pqTraceOutput_ReadyForQuery(conn->Pfdebug, message, &logCursor);
>> break;
>
> +1
>
> I prefer the new function names since it seems more natural and easier to read.
>
> I noticed pqTraceOutputNR() is left as is, is this intentional? Or, shoud this
> be changed to pqTranceOutput_NoticeResponse()?

pqTraceOutputNR() is shared code used internally by _ErrorResponse() and
_NoticeResponse(). I have updated the comments a bit to make this clearer.

With that, I have committed it. Thanks.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-05-02 14:35:25 Re: [PoC] Reducing planning time when tables have many partitions
Previous Message Tom Lane 2024-05-02 14:21:09 Re: EXPLAN redundant options