Re: IndexTupleDSize macro seems redundant - Mailing list pgsql-hackers

From Tom Lane
Subject Re: IndexTupleDSize macro seems redundant
Date
Msg-id 8984.1515692863@sss.pgh.pa.us
Whole thread Raw
In response to Re: IndexTupleDSize macro seems redundant  (Stephen Frost <sfrost@snowman.net>)
Responses Re: IndexTupleDSize macro seems redundant
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> I'll leave the patch status in 'Needs review' since there's more
> changes, but hopefully someone can take a look and we can move this
> along, seems like a pretty small and reasonable improvement.

I'm on board with Stephen's changes, except in _bt_restore_page.
The issue there is that the "from" pointer isn't necessarily adequately
aligned to be considered an IndexTuple pointer; that's why we're doing
the memcpy dance to get a length out of it.  "Item" doesn't connote
anything about alignment (it's the same as Pointer, ie char*).  Even
though we don't do anything with items[i] except pass it as an Item
to PageAddItem, the proposed change could result in breakage, because
the compiler could take it as license to assume that "from" is aligned,
and perhaps change what it generates for the memcpy.

I think that in the other places where Stephen wants to change Item
to something else, the alignment expectation actually does hold,
so we're OK if we want to do it in those places.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: master make check fails on Solaris 10
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] [PATCH] Generic type subscripting