1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Standardize LSN formatting by zero padding

This commit standardizes the output format for LSNs to ensure consistent
representation across various tools and messages.  Previously, LSNs were
inconsistently printed as `%X/%X` in some contexts, while others used
zero-padding.  This often led to confusion when comparing.

To address this, the LSN format is now uniformly set to `%X/%08X`,
ensuring the lower 32-bit part is always zero-padded to eight
hexadecimal digits.

Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
This commit is contained in:
Álvaro Herrera
2025-07-07 13:57:43 +02:00
parent 62a17a9283
commit 2633dae2e4
67 changed files with 681 additions and 681 deletions

View File

@@ -25,16 +25,16 @@
<programlisting>
postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0');
lsn | xid | data
-----------+-----+--------------------------------------------------
0/16D30F8 | 691 | BEGIN
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg'
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo'
0/16D32A0 | 691 | COMMIT
0/16D32D8 | 692 | BEGIN
0/16D3398 | 692 | table public.data: DELETE: id[int4]:2
0/16D3398 | 692 | table public.data: DELETE: id[int4]:3
0/16D3398 | 692 | COMMIT
lsn | xid | data
------------+-----+--------------------------------------------------
0/016D30F8 | 691 | BEGIN
0/016D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg'
0/016D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo'
0/016D32A0 | 691 | COMMIT
0/016D32D8 | 692 | BEGIN
0/016D3398 | 692 | table public.data: DELETE: id[int4]:2
0/016D3398 | 692 | table public.data: DELETE: id[int4]:3
0/016D3398 | 692 | COMMIT
(8 rows)
</programlisting>
</para>
@@ -45,18 +45,18 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'i
<programlisting>
postgres[33712]=#* SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'stream-changes', '1');
lsn | xid | data
-----------+-----+--------------------------------------------------
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
0/16B21F8 | 503 | streaming change for TXN 503
0/16B2300 | 503 | streaming change for TXN 503
0/16B2408 | 503 | streaming change for TXN 503
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
0/16B21F8 | 503 | opening a streamed block for transaction TXN 503
0/16BECA8 | 503 | streaming change for TXN 503
0/16BEDB0 | 503 | streaming change for TXN 503
0/16BEEB8 | 503 | streaming change for TXN 503
0/16BEBA0 | 503 | closing a streamed block for transaction TXN 503
lsn | xid | data
------------+-----+--------------------------------------------------
0/016B21F8 | 503 | opening a streamed block for transaction TXN 503
0/016B21F8 | 503 | streaming change for TXN 503
0/016B2300 | 503 | streaming change for TXN 503
0/016B2408 | 503 | streaming change for TXN 503
0/016BEBA0 | 503 | closing a streamed block for transaction TXN 503
0/016B21F8 | 503 | opening a streamed block for transaction TXN 503
0/016BECA8 | 503 | streaming change for TXN 503
0/016BEDB0 | 503 | streaming change for TXN 503
0/016BEEB8 | 503 | streaming change for TXN 503
0/016BEBA0 | 503 | closing a streamed block for transaction TXN 503
(10 rows)
</programlisting>
</para>