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

Commitc788115

Browse files
Paper over bt_metap() oldest_xact bug in backbranches.
The data types that contrib/pageinspect's bt_metap() function weredeclared to return as OUT arguments were wrong in some cases. Inparticular, the oldest_xact column (a TransactionId/xid field) wasdeclared integer/int4 within the pageinspect extension's sql file. Thisled to errors when an oldest_xact value that exceeded 2^31-1 wasencountered.We cannot fix the declaration on Postgres 11 or 12. All we can do isameliorate the problem. Use "%d" instead of "%u" to format the outputof the oldest_xact value. This makes the C code match the declaration,suppressing unhelpful error messages that might otherwise makebt_metap() totally unusable. A bogus negative oldest_xact value will bedisplayed instead of raising an error.This commit addresses the same issue as master branch commit691e8b2,which actually fixed the problem. Backpatch to the 11 and 12 branchesonly, since they are the only branches (other than master) that haveoldest_xact. All of the other problematic columns already display bogusoutput for out of range values.Reported-By: Victor YegorovBug: #16285Discussion:https://postgr.es/m/20200309223557.aip5n6ewln4ixbbi@alap3.anarazel.deBackpatch: 11 and 12 only
1 parente70187c commitc788115

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎contrib/pageinspect/btreefuncs.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,12 @@ bt_metap(PG_FUNCTION_ARGS)
562562
*/
563563
if (metad->btm_version==BTREE_VERSION)
564564
{
565-
values[j++]=psprintf("%u",metad->btm_oldest_btpo_xact);
565+
/*
566+
* kludge: btm_oldest_btpo_xact is declared as int4, which is wrong.
567+
* We should at least avoid raising an error when its value happens to
568+
* exceed PG_INT32_MAX, though.
569+
*/
570+
values[j++]=psprintf("%d", (int)metad->btm_oldest_btpo_xact);
566571
values[j++]=psprintf("%f",metad->btm_last_cleanup_num_heap_tuples);
567572
}
568573
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp