Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Maxim Orlov <orlovmg(at)gmail(dot)com>, Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Ilya Anfimov <ilan(at)tzirechnoy(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Date: 2022-03-17 14:41:08
Message-ID: 771048.1647528068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Japin Li <japinli(at)hotmail(dot)com> writes:
> Maybe, we should format it to string before for localization messages,
> like the following code snippet comes from pg_backup_tar.c.
> However, I do not think it is a good way.

> snprintf(buf1, sizeof(buf1), INT64_FORMAT, (int64) len);
> snprintf(buf2, sizeof(buf2), INT64_FORMAT, (int64) th->fileLen);
> fatal("actual file length (%s) does not match expected (%s)",
> buf1, buf2);

That used to be our standard practice before we switched to always
relying on our own snprintf.c. Now, we know that "%lld" with an
explicit cast to long long will work, so that's the preferred method
for printing 64-bit values in localizable strings. Not all of the old
code has been updated, though.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2022-03-17 14:46:30 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Previous Message Peter Eisentraut 2022-03-17 14:17:29 Re: Column Filtering in Logical Replication