Re: Printing LSN made easy - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Printing LSN made easy
Date
Msg-id c7070d64-5edf-1206-616f-f34a57cdc1a4@2ndquadrant.com
Whole thread Raw
In response to Printing LSN made easy  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: Printing LSN made easy  (Michael Paquier <michael@paquier.xyz>)
Re: Printing LSN made easy  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-hackers
On 2020-11-27 11:40, Ashutosh Bapat wrote:
> The solution seems to be simple though. In the attached patch, I have
> added two macros
> #define LSN_FORMAT "%X/%X"
> #define LSN_FORMAT_ARG(lsn) (uint32) ((lsn) >> 32), (uint32) (lsn)
> 
> which can be used instead.

It looks like we are not getting any consensus on this approach.  One 
reduced version I would consider is just the second part, so you'd write 
something like

     snprintf(lsnchar, sizeof(lsnchar), "%X/%X",
              LSN_FORMAT_ARGS(lsn));

This would still reduce notational complexity quite a bit but avoid any 
funny business with the format strings.

-- 
Peter Eisentraut
2ndQuadrant, an EDB company
https://www.2ndquadrant.com/



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Next
From: Tom Lane
Date:
Subject: Re: [PATCH 1/1] Initial mach based shared memory support.