]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add logical decoding status to pg_control_checkpoint().
authorMasahiko Sawada <msawada@postgresql.org>
Tue, 21 Jul 2026 00:11:17 +0000 (17:11 -0700)
committerMasahiko Sawada <msawada@postgresql.org>
Tue, 21 Jul 2026 00:11:17 +0000 (17:11 -0700)
Commit 8108765f04b added the logical decoding status to the
pg_controldata output, but overlooked the pg_control_checkpoint() SQL
function, which reports the same checkpoint information. This commit
adds a logical_decoding column to pg_control_checkpoint(), placed
after full_page_writes to match the pg_controldata output order.

Oversight in 8108765f04b.

Bump catalog version.

Reported-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEkp1-1n5iC38+yHSNh955+KshwtCL6DzA0vk_vuUF_Eg@mail.gmail.com
Backpatch-through: 19

doc/src/sgml/func/func-info.sgml
src/backend/utils/misc/pg_controldata.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat

index 69ef3857cfa20481c9c50b0a8cafb9f5161678df..122fc740f1aa6da0987bd0961ba1323f1022cfdc 100644 (file)
@@ -3436,6 +3436,11 @@ acl      | {postgres=arwdDxtm/postgres,foo=r/postgres}
        <entry><type>boolean</type></entry>
       </row>
 
+      <row>
+       <entry><structfield>logical_decoding</structfield></entry>
+       <entry><type>boolean</type></entry>
+      </row>
+
       <row>
        <entry><structfield>next_xid</structfield></entry>
        <entry><type>text</type></entry>
index c6d9cbb1577fa40c31c5b5e503bd5969f0811c19..d229ae352095c99f73b712cb3bc1b128247c523b 100644 (file)
@@ -69,8 +69,8 @@ pg_control_system(PG_FUNCTION_ARGS)
 Datum
 pg_control_checkpoint(PG_FUNCTION_ARGS)
 {
-       Datum           values[18];
-       bool            nulls[18];
+       Datum           values[19];
+       bool            nulls[19];
        TupleDesc       tupdesc;
        HeapTuple       htup;
        ControlFileData *ControlFile;
@@ -116,44 +116,47 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
        values[5] = BoolGetDatum(ControlFile->checkPointCopy.fullPageWrites);
        nulls[5] = false;
 
-       values[6] = CStringGetTextDatum(psprintf("%u:%u",
-                                                                                        EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid),
-                                                                                        XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid)));
+       values[6] = BoolGetDatum(ControlFile->checkPointCopy.logicalDecodingEnabled);
        nulls[6] = false;
 
-       values[7] = ObjectIdGetDatum(ControlFile->checkPointCopy.nextOid);
+       values[7] = CStringGetTextDatum(psprintf("%u:%u",
+                                                                                        EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid),
+                                                                                        XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid)));
        nulls[7] = false;
 
-       values[8] = TransactionIdGetDatum(ControlFile->checkPointCopy.nextMulti);
+       values[8] = ObjectIdGetDatum(ControlFile->checkPointCopy.nextOid);
        nulls[8] = false;
 
-       values[9] = TransactionIdGetDatum(ControlFile->checkPointCopy.nextMultiOffset);
+       values[9] = TransactionIdGetDatum(ControlFile->checkPointCopy.nextMulti);
        nulls[9] = false;
 
-       values[10] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestXid);
+       values[10] = TransactionIdGetDatum(ControlFile->checkPointCopy.nextMultiOffset);
        nulls[10] = false;
 
-       values[11] = ObjectIdGetDatum(ControlFile->checkPointCopy.oldestXidDB);
+       values[11] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestXid);
        nulls[11] = false;
 
-       values[12] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestActiveXid);
+       values[12] = ObjectIdGetDatum(ControlFile->checkPointCopy.oldestXidDB);
        nulls[12] = false;
 
-       values[13] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestMulti);
+       values[13] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestActiveXid);
        nulls[13] = false;
 
-       values[14] = ObjectIdGetDatum(ControlFile->checkPointCopy.oldestMultiDB);
+       values[14] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestMulti);
        nulls[14] = false;
 
-       values[15] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestCommitTsXid);
+       values[15] = ObjectIdGetDatum(ControlFile->checkPointCopy.oldestMultiDB);
        nulls[15] = false;
 
-       values[16] = TransactionIdGetDatum(ControlFile->checkPointCopy.newestCommitTsXid);
+       values[16] = TransactionIdGetDatum(ControlFile->checkPointCopy.oldestCommitTsXid);
        nulls[16] = false;
 
-       values[17] = TimestampTzGetDatum(time_t_to_timestamptz(ControlFile->checkPointCopy.time));
+       values[17] = TransactionIdGetDatum(ControlFile->checkPointCopy.newestCommitTsXid);
        nulls[17] = false;
 
+       values[18] = TimestampTzGetDatum(time_t_to_timestamptz(ControlFile->checkPointCopy.time));
+       nulls[18] = false;
+
        htup = heap_form_tuple(tupdesc, values, nulls);
 
        PG_RETURN_DATUM(HeapTupleGetDatum(htup));
index f046605ccf917bef532c0951d318e1a929023bea..d0399cc1cbeec305e4bcb4631e40dd1499db0be5 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                                                     yyyymmddN */
-#define CATALOG_VERSION_NO     202607173
+#define CATALOG_VERSION_NO     202607201
 
 #endif
index 1c55a4dea345203fb2bdf9a4c3adb97f2311b1c1..f8a021987b5e5bf97b524cebe0e0f9d7372bdbff 100644 (file)
   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,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}',
-  proargnames => '{checkpoint_lsn,redo_lsn,redo_wal_file,timeline_id,prev_timeline_id,full_page_writes,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,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}',
   prosrc => 'pg_control_checkpoint' },
 
 { oid => '3443',