Re: minimal update

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minimal update
Date: 2007-12-29 01:26:06
Message-ID: 4775A22E.6090306@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> How does this look?
>>
>
>
>> if (newtuple->t_len == oldtuple->t_len &&
>> newtuple->t_data->t_hoff == oldtuple->t_data->t_hoff &&
>> HeapTupleHeaderGetNatts(newtuple) == HeapTupleHeaderGetNatts(oldtuple) &&
>> (newtuple->t_data->t_infomask & (HEAP_HASOID|HEAP_HASNULL)) == (oldtuple->t_data->t_infomask & (HEAP_HASOID|HEAP_HASNULL)) &&
>> memcmp(newtuple->t_data + offsetof(HeapTupleHeaderData, t_bits),
>> oldtuple->t_data + offsetof(HeapTupleHeaderData, t_bits)
>> newtuple->t_len - offsetof(HeapTupleHeaderData, t_bits)) == 0)
>>
>
>
>> rettuple = NULL;
>>
>
> Looks sane. It might be even saner if you compare all of the
> non-visibility-related infomask bits, viz
>
> (newtuple->t_data->t_infomask & ~HEAP_XACT_MASK) ==
> (oldtuple->t_data->t_infomask & ~HEAP_XACT_MASK)
>
> rather than just HASOID and HASNULL.
>
>
>

Sadly, the memcmp is failing on my test ("update foo set bar = bar") on
8.2. Looks like I'm in for weekend with my fave debugger :-(

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-12-29 02:35:45 Re: Spoofing as the postmaster
Previous Message Greg Smith 2007-12-29 01:20:38 Re: Archiver behavior at shutdown