On Fri, Feb 19, 2021 at 10:54:05AM +0900, Kyotaro Horiguchi wrote:
> At Thu, 18 Feb 2021 18:51:37 +0530, Ashutosh Bapat
> wrote in
>> On Thu, Feb 18, 2021 at 6:19 PM Peter Eisentraut <
>> peter.eisentr...@2ndquadrant.com> wrote:
>>> Here is an updated patch that just introduces LSN_FORMAT_ARGS()
At Thu, 18 Feb 2021 18:51:37 +0530, Ashutosh Bapat
wrote in
> On Thu, Feb 18, 2021 at 6:19 PM Peter Eisentraut <
> peter.eisentr...@2ndquadrant.com> wrote:
>
> > Here is an updated patch that just introduces LSN_FORMAT_ARGS(). I
> > think the result is quite pleasant.
> >
>
> Thanks a lot Pet
On Thu, Feb 18, 2021 at 6:19 PM Peter Eisentraut <
peter.eisentr...@2ndquadrant.com> wrote:
> Here is an updated patch that just introduces LSN_FORMAT_ARGS(). I
> think the result is quite pleasant.
>
Thanks a lot Peter for producing this patch. I am fine with it. The way
this is defined someone
Here is an updated patch that just introduces LSN_FORMAT_ARGS(). I
think the result is quite pleasant.
--
Peter Eisentraut
2ndQuadrant, an EDB company
https://www.2ndquadrant.com/
From 91d831518c8a71b010bdc835caacaedb20ffb896 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut
Date: Thu, 18 Feb 20
On Thu, Jan 21, 2021 at 3:53 PM Peter Eisentraut <
peter.eisentr...@2ndquadrant.com> wrote:
> On 2021-01-20 08:50, Ashutosh Bapat wrote:
> > Thanks for looking into this. I would like to keep both the LSN_FORMAT
> > and LSN_FORMAT_ARGS but with a note that the first can not be used in
> > elog() o
On 2021-01-20 08:50, Ashutosh Bapat wrote:
Thanks for looking into this. I would like to keep both the LSN_FORMAT
and LSN_FORMAT_ARGS but with a note that the first can not be used in
elog() or in messages which require localization. We have many other
places doing snprintf() and such stuff, wh
At Wed, 20 Jan 2021 16:40:59 +0900, Michael Paquier wrote
in
> On Wed, Jan 20, 2021 at 07:25:37AM +0100, Peter Eisentraut wrote:
> > 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 li
On Wed, Jan 20, 2021 at 11:55 AM Peter Eisentraut <
peter.eisentr...@2ndquadrant.com> wrote:
> 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) (u
On Wed, Jan 20, 2021 at 07:25:37AM +0100, Peter Eisentraut wrote:
> 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",
> L
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 consen
On Mon, Nov 30, 2020 at 8:07 PM Alvaro Herrera
wrote:
> On 2020-Nov-30, Ashutosh Bapat wrote:
>
> > Peter Eisentraut explained that the translation system can not handle
> > strings broken by macros, e.g. errmsg("foo" MACRO "bar"), since it
> doesn't
> > know statically what the macro resolves to
On Mon, Nov 30, 2020 at 7:38 PM Li Japin wrote:
> Hi,
>
> On Nov 30, 2020, at 9:06 PM, Ashutosh Bapat
> wrote:
>
> On Fri, Nov 27, 2020 at 9:51 PM Li Japin wrote:
>
>
> Hi,
>
> Here, we cannot use sizeof(but) to get the buf size, because it is a
> pointer, so it always
> 8 bytes on 64-bit or 4
Hi,
On 2020-11-29 12:10:21 -0500, Tom Lane wrote:
> Agreed. snprintf.c is meant to implement a recognized standard
> (ok, %m is a GNU extension, but it's still pretty standard).
> I'm not on board with putting PG-only extensions in there.
I wonder if there's something we could layer on the elog.
On 2020-Nov-30, Ashutosh Bapat wrote:
> Peter Eisentraut explained that the translation system can not handle
> strings broken by macros, e.g. errmsg("foo" MACRO "bar"), since it doesn't
> know statically what the macro resolves to. But I am not familiar with our
> translation system myself. But i
Hi,
On Nov 30, 2020, at 9:06 PM, Ashutosh Bapat
mailto:ashutosh.bapat@gmail.com>> wrote:
On Fri, Nov 27, 2020 at 9:51 PM Li Japin
mailto:japi...@hotmail.com>> wrote:
Hi,
Here, we cannot use sizeof(but) to get the buf size, because it is a pointer,
so it always
8 bytes on 64-bit or 4 byte
On Sun, Nov 29, 2020 at 10:40 PM Tom Lane wrote:
> Michael Paquier writes:
> > On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote:
> >> 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
> >> rele
On Sun, Nov 29, 2020 at 1:23 PM Michael Paquier wrote:
> 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 Eisentra
On Fri, Nov 27, 2020 at 9:51 PM Li Japin wrote:
>
> Hi,
>
> Here, we cannot use sizeof(but) to get the buf size, because it is a pointer,
> so it always
> 8 bytes on 64-bit or 4 bytes on 32-bit machine.
For an array, the sizeof() returns the size of memory consumed by the
array. See section "App
On Fri, Nov 27, 2020 at 7:54 PM Alexey Kondratov
wrote:
>
> Hi,
>
> On 2020-11-27 13:40, Ashutosh Bapat wrote:
> >
> > 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 retu
On Mon, Nov 30, 2020 at 1:10 AM Tom Lane wrote:
> Michael Paquier writes:
> > On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote:
> >> 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
> >> relev
Michael Paquier writes:
> On Fri, Nov 27, 2020 at 04:10:27PM +0530, Ashutosh Bapat wrote:
>> 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
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 sin
Hi,
Here, we cannot use sizeof(but) to get the buf size, because it is a pointer,
so it always
8 bytes on 64-bit or 4 bytes on 32-bit machine.
+char *
+pg_lsn_out_buffer(XLogRecPtr lsn, char *buf)
+{
+ snprintf(buf, sizeof(buf), LSN_FORMAT, LSN_FORMAT_ARG(lsn));
+
+ return buf;
+}
-
Hi,
On 2020-11-27 13:40, Ashutosh Bapat wrote:
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.
The patch has two functions pg_lsn_out_
Hi All,
An LSN is printed using format "%X/%X" and passing (uint32) (lsn >>
32), (uint32) lsn as arguments to that format specifier. This pattern
is repeated at 180 places according to Cscope. I find it hard to
remember this pattern every time I have to print LSN. Usually I end up
copying from some
25 matches
Mail list logo