1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Add logical decoding status to pg_control_checkpoint().

Commit 8108765f04 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 8108765f04.

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
This commit is contained in:
Masahiko Sawada
2026-07-20 17:11:21 -07:00
parent a649138d85
commit 4ca78f292d
4 changed files with 28 additions and 20 deletions

View 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>

View 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));

View File

@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202607172
#define CATALOG_VERSION_NO 202607201
#endif

View File

@@ -12346,9 +12346,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,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',