Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbade01c

Browse files
Fix recent pg_walinspect fpi_length bug.
Commit0276ae4 taught pg_walinspect's pg_get_wal_record_info()function to output NULLs rather than empty strings for its recorddescription and block_ref output parameters. However, it inadvertentlymoved the function call that sets fpi_length until after it was alreadyset. As a result, pg_get_wal_record_info() always output spuriousfpi_length values of 0.Fix by switching the order back (but keep the behavioral change).Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Discussion:https://postgr.es/m/CAH2-WzkJmgSYkt6-smQ+57SxSmov+EKqFZdSimFewosoL_JKoA@mail.gmail.com
1 parent326a33a commitbade01c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎contrib/pg_walinspect/pg_walinspect.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ GetWALRecordInfo(XLogReaderState *record, Datum *values,
186186
RmgrDatadesc;
187187
uint32fpi_len=0;
188188
StringInfoDatarec_desc;
189+
StringInfoDatarec_blk_ref;
189190
inti=0;
190191

191192
desc=GetRmgr(XLogRecGetRmid(record));
@@ -197,6 +198,12 @@ GetWALRecordInfo(XLogReaderState *record, Datum *values,
197198
initStringInfo(&rec_desc);
198199
desc.rm_desc(&rec_desc,record);
199200

201+
if (XLogRecHasAnyBlockRefs(record))
202+
{
203+
initStringInfo(&rec_blk_ref);
204+
XLogRecGetBlockRefInfo(record, false, true,&rec_blk_ref,&fpi_len);
205+
}
206+
200207
values[i++]=LSNGetDatum(record->ReadRecPtr);
201208
values[i++]=LSNGetDatum(record->EndRecPtr);
202209
values[i++]=LSNGetDatum(XLogRecGetPrev(record));
@@ -205,23 +212,15 @@ GetWALRecordInfo(XLogReaderState *record, Datum *values,
205212
values[i++]=CStringGetTextDatum(id);
206213
values[i++]=UInt32GetDatum(XLogRecGetTotalLen(record));
207214
values[i++]=UInt32GetDatum(XLogRecGetDataLen(record));
208-
209215
values[i++]=UInt32GetDatum(fpi_len);
210216

211217
if (rec_desc.len>0)
212218
values[i++]=CStringGetTextDatum(rec_desc.data);
213219
else
214220
nulls[i++]= true;
215221

216-
/* Block references. */
217222
if (XLogRecHasAnyBlockRefs(record))
218-
{
219-
StringInfoDatarec_blk_ref;
220-
221-
initStringInfo(&rec_blk_ref);
222-
XLogRecGetBlockRefInfo(record, false, true,&rec_blk_ref,&fpi_len);
223223
values[i++]=CStringGetTextDatum(rec_blk_ref.data);
224-
}
225224
else
226225
nulls[i++]= true;
227226

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp