Thread: GIN function of pageinspect has inconsistency data type.

GIN function of pageinspect has inconsistency data type.

From
Sawada Masahiko
Date:
Hi all,

I noticed while using gin function of pageinspect that there are some
inconsistency data types.
For example, data type of GinMetaPageData.head, and tail  is
BlockNumber, i.g, uint32.
But in ginfunc.c, we get that value as int64.

So I think the output is odd a little. Is it intentional?

- Before
postgres(1)=# select pending_head, pending_tail from
gin_metapage_info(get_raw_page('trgm_idx'::text, 0));
 pending_head | pending_tail
--------------------+--------------
   4294967295  |   4294967295
(1 row)

- After attaching patch
postgres(1)=# select pending_head, pending_tail from
gin_metapage_info(get_raw_page('trgm_idx'::text, 0));
 pending_head | pending_tail
--------------------+------------------
           -1           |           -1

There are some similar cases except above, so the fixing patch around
ginfunc.c is attached.

Regards,

-------
Sawada Masahiko

Attachment

Re: GIN function of pageinspect has inconsistency data type.

From
Jim Nasby
Date:
On 6/16/15 8:26 AM, Sawada Masahiko wrote:
> I noticed while using gin function of pageinspect that there are some
> inconsistency data types.
> For example, data type of GinMetaPageData.head, and tail  is
> BlockNumber, i.g, uint32.
> But in ginfunc.c, we get that value as int64.

You can't put a uint32 into a signed int32 (which is what the SQL int 
is). That's why it's returning a bigint.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Data in Trouble? Get it in Treble! http://BlueTreble.com



Re: GIN function of pageinspect has inconsistency data type.

From
Sawada Masahiko
Date:
On Wed, Jun 17, 2015 at 4:11 PM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
> On 6/16/15 8:26 AM, Sawada Masahiko wrote:
>>
>> I noticed while using gin function of pageinspect that there are some
>> inconsistency data types.
>> For example, data type of GinMetaPageData.head, and tail  is
>> BlockNumber, i.g, uint32.
>> But in ginfunc.c, we get that value as int64.
>
>
> You can't put a uint32 into a signed int32 (which is what the SQL int is).
> That's why it's returning a bigint.

I understood why it's returning a bigint.
Thanks!

Regards,

--
Sawada Masahiko