[HACKERS] wrong t_bits alignment in pageinspect

From: Maksim Milyutin <milyutinma(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: [HACKERS] wrong t_bits alignment in pageinspect
Date: 2017-12-15 13:53:41
Message-ID: ec295792-a69f-350f-6287-25a20e8f31d5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

I found out the problem in exposing values of t_bits field from
heap_page_items function.

When the number of attributes in table is multiple of eight, t_bits
column shows double number of bits in which data fields are included.

For example:

# create table tbl(f1 int, f2 int, f3 int, f4 int, f5 int, f6 int, f7
int, f8 int);
# insert into tbl(f1, f8) values (x'f1'::int, 0);

# select t_bits, t_data from heap_page_items(get_raw_page('tbl', 0));

                   t_bits      |       t_data
           ------------------+--------------------
 1000000110001111 | \xf100000000000000

I suppose the prefix 10000001 corresponds to real value of t_bits, the
rest part 10001111 - to the lower byte of f1 field of tbl.

Attached patch fixes this issue.

--
Regards,
Maksim Milyutin

Attachment Content-Type Size
pageinspect_tbits_alignment_fix.patch text/x-patch 507 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arseny Sher 2017-12-15 13:58:23 Re: GSoC 2018
Previous Message Aleksander Alekseev 2017-12-15 13:52:18 Re: GSoC 2018