From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, ashutosh(dot)bapat(at)enterprisedb(dot)com, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com> |
Subject: | Re: Printing LSN made easy |
Date: | 2020-11-29 07:52:59 |
Message-ID: | X8NTWw/pvyX7nFZa@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote:
> LSN_FORMAT_ARG expands to two comma separated arguments and is kinda
> open at both ends but it's handy that way.
Agreed that's useful.
> Off list Peter Eisentraut pointed out that we can not use these macros
> in elog/ereport since it creates problems for translations. He
> suggested adding functions which return strings and use %s when doing
> so.
What's the problem with translations? We already have equivalent
stuff with INT64_FORMAT that may map to %ld or %lld. But here we have
a format that's set in stone.
> The patch has two functions pg_lsn_out_internal() which takes an LSN
> as input and returns a palloc'ed string containing the string
> representation of LSN. This may not be suitable in performance
> critical paths and also may leak memory if not freed.
I'd rather never use this flavor. An OOM could mask the actual error
behind.
> Off list Craig Ringer suggested introducing a new format specifier
> similar to %m for LSN but I did not get time to take a look at the
> relevant code. AFAIU it's available only to elog/ereport, so may not
> be useful generally. But teaching printf variants about the new format
> would be the best solution. However, I didn't find any way to do that.
-1. %m maps to errno, that is much more generic. A set of macros
that maps to our internal format would be fine enough IMO.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Kasahara Tatsuhito | 2020-11-29 13:34:16 | Re: autovac issue with large number of tables |
Previous Message | Michael Paquier | 2020-11-29 07:14:39 | Re: configure and DocBook XML |