Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]
Date: 2015-02-21 21:08:25
Message-ID: 20150221210825.GB2037@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-02-21 15:16:55 -0500, Tom Lane wrote:
> Andres, would you double-check the changes in reorderbuffer.c?
> There were some weird calculations with
> offsetof(ReorderBufferTupleBuf, data) - offsetof(HeapTupleHeaderData, t_bits)
> which Michael simplified in a way that's not 100% equivalent. I think
> it's probably better this way; it looks like the old coding was maybe
> wrong, or at least in the habit of misaligning data. But I might be
> misunderstanding.

Hm, yea, that looks/looked slightly wierd. I think it's actually correct
though: HeapTupleData's t_len include's HeapTupleHeaderData itself and
offsetof(ReorderBufferTupleBuf, data) points to *after*
HeapTupleHeaderData. As this is only the length computation, not the
copy, I don't see an active issue. Why I wrote it that way, instead of
using offsetof(ReorderBufferTupleBuf, header) + t_len - which should be
equivalent - I don't know.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-02-21 21:09:02 Re: Add min and max execute statement time in pg_stat_statement
Previous Message Peter Geoghegan 2015-02-21 20:41:39 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} 2.0