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

Commitad592f4

Browse files
committed
Fix incorrect computations of length of null bitmap in pageinspect.
Instead of using our standard macro for this calculation, this codedid it itself ... and got it wrong, leading to incorrect display ofthe null bitmap in some cases. Noted and fixed by Maksim Milyutin.In passing, remove a uselessly duplicative error check.Errors were introduced in commitd6061f8; back-patch to 9.6where that came in.Maksim Milyutin, reviewed by Andrey BorodinDiscussion:https://postgr.es/m/ec295792-a69f-350f-6287-25a20e8f31d5@gmail.com
1 parent2157a61 commitad592f4

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎contrib/pageinspect/heapfuncs.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ heap_page_items(PG_FUNCTION_ARGS)
232232
intbits_len;
233233

234234
bits_len=
235-
((tuphdr->t_infomask2&HEAP_NATTS_MASK) /8+1)*8;
235+
BITMAPLEN(HeapTupleHeaderGetNatts(tuphdr))*BITS_PER_BYTE;
236236
values[11]=CStringGetTextDatum(
237237
bits_to_text(tuphdr->t_bits,bits_len));
238238
}
@@ -434,24 +434,19 @@ tuple_data_split(PG_FUNCTION_ARGS)
434434
intbits_str_len;
435435
intbits_len;
436436

437-
bits_len= (t_infomask2&HEAP_NATTS_MASK)/8+1;
437+
bits_len=BITMAPLEN(t_infomask2&HEAP_NATTS_MASK)*BITS_PER_BYTE;
438438
if (!t_bits_str)
439439
ereport(ERROR,
440440
(errcode(ERRCODE_DATA_CORRUPTED),
441441
errmsg("argument of t_bits is null, but it is expected to be null and %d character long",
442-
bits_len*8)));
442+
bits_len)));
443443

444444
bits_str_len=strlen(t_bits_str);
445-
if ((bits_str_len %8)!=0)
446-
ereport(ERROR,
447-
(errcode(ERRCODE_DATA_CORRUPTED),
448-
errmsg("length of t_bits is not a multiple of eight")));
449-
450-
if (bits_len*8!=bits_str_len)
445+
if (bits_len!=bits_str_len)
451446
ereport(ERROR,
452447
(errcode(ERRCODE_DATA_CORRUPTED),
453448
errmsg("unexpected length of t_bits %u, expected %d",
454-
bits_str_len,bits_len*8)));
449+
bits_str_len,bits_len)));
455450

456451
/* do the conversion */
457452
t_bits=text_to_bits(t_bits_str,bits_str_len);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp