Re: [PATCH] Remove workarounds to format [u]int64's - Mailing list pgsql-hackers

From Pavel Borisov
Subject Re: [PATCH] Remove workarounds to format [u]int64's
Date
Msg-id CALT9ZEH1HHYgU6QKzX9qwuGcYpqr5Nojgphu9zG3fYXxTtmiTQ@mail.gmail.com
Whole thread Raw
In response to [PATCH] Remove workarounds to format [u]int64's  (Aleksander Alekseev <aleksander@timescale.com>)
Responses Re: [PATCH] Remove workarounds to format [u]int64's  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers


пн, 21 мар. 2022 г. в 12:52, Aleksander Alekseev <aleksander@timescale.com>:
Hi hackers,

I learned from Tom [1] that we can simplify the code like:

```
char buff[32];
snprintf(buf, sizeof(buf), INT64_FORMAT, ...)
ereport(WARNING, (errmsg("%s ...", buf)));
```

... and rely on %lld/%llu now as long as we explicitly cast the
argument to long long int / unsigned long long. This was previously
addressed in 6a1cd8b9 and d914eb34, but I see more places where we
still use an old approach.

Suggested patch fixes this. Tested locally - no warnings; passes all the tests.

[1] https://www.postgresql.org/message-id/771048.1647528068%40sss.pgh.pa.us

Hi, Alexander!
Probably you can do (long long) instead of (long long int). It is shorter and this is used elsewhere in the code.

--
Best regards,
Pavel Borisov

Postgres Professional: http://postgrespro.com

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: [PATCH] Remove workarounds to format [u]int64's
Next
From: Aleksander Alekseev
Date:
Subject: Re: [PATCH] Remove workarounds to format [u]int64's