Hi Commit f19c0eccae adds the data_checksum_version field to the pg_controldata output, but there is no matching entry in "pg_control_checkpoint()". I can't see any reason why this is omitted (I don't see any mention of it in the corresponding -hackers thread [*]) so assume it's not intentional. A similar update was made in 99e949f84 for logical decoding status.
Patch attached; apologies in advance if this is noise. [*] https://www.postgresql.org/message-id/flat/300822bd-daeb-49e5-8af7-d7ce3af65adc%40iki.fi#a5fbff0299b5f2c268ae4e02d2d7479b Regards Ian Barwick
From e14b40a3abdd938e84e6375e7fe96da491ef3c36 Mon Sep 17 00:00:00 2001 From: Ian Barwick <[email protected]> Date: Mon, 10 Aug 2026 13:12:51 +0900 Subject: [PATCH v1] Add data_checksum_version to pg_control_checkpoint(). Commit f19c0eccae added the data_checksum_version to the pg_controldata output, but omitted a corresponding change to the pg_control_checkpoint() SQL function, which reports the same checkpoint information. This commit adds a column "data_checksum_version" to pg_control_checkpoint(), placed before "checkpoint_time" to match the pg_controldata output order. --- doc/src/sgml/func/func-info.sgml | 5 +++++ src/backend/utils/misc/pg_controldata.c | 9 ++++++--- src/include/catalog/pg_proc.dat | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/func/func-info.sgml b/doc/src/sgml/func/func-info.sgml index 122fc740f1a..ad6b6ad56e2 100644 --- a/doc/src/sgml/func/func-info.sgml +++ b/doc/src/sgml/func/func-info.sgml @@ -3496,6 +3496,11 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres} <entry><type>xid</type></entry> </row> + <row> + <entry><structfield>data_checksum_version</structfield></entry> + <entry><type>integer</type></entry> + </row> + <row> <entry><structfield>checkpoint_time</structfield></entry> <entry><type>timestamp with time zone</type></entry> diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index d229ae35209..9cb3eea9f3a 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -69,8 +69,8 @@ pg_control_system(PG_FUNCTION_ARGS) Datum pg_control_checkpoint(PG_FUNCTION_ARGS) { - Datum values[19]; - bool nulls[19]; + Datum values[20]; + bool nulls[20]; TupleDesc tupdesc; HeapTuple htup; ControlFileData *ControlFile; @@ -154,9 +154,12 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) values[17] = TransactionIdGetDatum(ControlFile->checkPointCopy.newestCommitTsXid); nulls[17] = false; - values[18] = TimestampTzGetDatum(time_t_to_timestamptz(ControlFile->checkPointCopy.time)); + values[18] = Int32GetDatum(ControlFile->checkPointCopy.dataChecksumState); nulls[18] = false; + values[19] = TimestampTzGetDatum(time_t_to_timestamptz(ControlFile->checkPointCopy.time)); + nulls[19] = false; + htup = heap_form_tuple(tupdesc, values, nulls); PG_RETURN_DATUM(HeapTupleGetDatum(htup)); diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index f8a021987b5..7465ee0f4b7 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -12371,9 +12371,9 @@ descr => 'pg_controldata checkpoint state information as a function', proname => 'pg_control_checkpoint', provolatile => 'v', prorettype => 'record', proargtypes => '', - proallargtypes => '{pg_lsn,pg_lsn,text,int4,int4,bool,bool,text,oid,xid,xid,xid,oid,xid,xid,oid,xid,xid,timestamptz}', - proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}', - proargnames => '{checkpoint_lsn,redo_lsn,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,logical_decoding,next_xid,next_oid,next_multixact_id,next_multi_offset,oldest_xid,oldest_xid_dbid,oldest_active_xid,oldest_multi_xid,oldest_multi_dbid,oldest_commit_ts_xid,newest_commit_ts_xid,checkpoint_time}', + proallargtypes => '{pg_lsn,pg_lsn,text,int4,int4,bool,bool,text,oid,xid,xid,xid,oid,xid,xid,oid,xid,xid,int4,timestamptz}', + proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}', + proargnames => '{checkpoint_lsn,redo_lsn,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,logical_decoding,next_xid,next_oid,next_multixact_id,next_multi_offset,oldest_xid,oldest_xid_dbid,oldest_active_xid,oldest_multi_xid,oldest_multi_dbid,oldest_commit_ts_xid,newest_commit_ts_xid,data_checksum_version,checkpoint_time}', prosrc => 'pg_control_checkpoint' }, { oid => '3443', -- 2.52.0
