Re: TupleDescCopy doesn't clear atthasdef, attnotnull, attidentity

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: TupleDescCopy doesn't clear atthasdef, attnotnull, attidentity
Дата
Msg-id 25466.1515051830@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: TupleDescCopy doesn't clear atthasdef, attnotnull, attidentity  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> The reason I note this explicitly is that I don't find it to be
> entirely safe.  If ATTRIBUTE_FIXED_PART_SIZE were less than
> sizeof(FormData_pg_attribute) due to alignment padding at the end of
> the struct, I think we would get some valgrind complaints about copying
> uninitialized data, since there are code paths in which only the first
> ATTRIBUTE_FIXED_PART_SIZE bytes of each array entry get filled in.

After further study I think this is a false alarm.  valgrind doesn't
actually whine when you memcpy some undefined bytes: it just propagates
the undefined-ness of those bytes to the destination, and complains only
if the program uses the destination bytes to do something meaningful.
(Were this not so, copying structs containing embedded padding bytes
would always cause bogus warnings.)

There might still be value in redefining ATTRIBUTE_FIXED_PART_SIZE as
sizeof(FormData_pg_attribute), but I'm not sure, and am sort of inclined
to leave it alone.

            regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Tsunakawa, Takayuki"
Дата:
Сообщение: RE: Libpq support to connect to standby server as priority
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] UPDATE of partition key