Re: tuptoaster.c must *not* use SnapshotAny - Mailing list pgsql-hackers

From Tom Lane
Subject Re: tuptoaster.c must *not* use SnapshotAny
Date
Msg-id 2687.1011323548@sss.pgh.pa.us
Whole thread Raw
In response to Re: tuptoaster.c must *not* use SnapshotAny  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Responses Re: tuptoaster.c must *not* use SnapshotAny  (Jan Wieck <janwieck@yahoo.com>)
List pgsql-hackers
Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> The same snapshot for both the main and the toast table
> seems better though I don't know how it's difficult to
> change.

That would be cleaner but I don't see any way to do it.  The toasted
value gets passed all over the system, potentially, before someone asks
to detoast it.  At that point you really don't have a good way to know
which snapshot was used to fetch the main-table row.

> For example is it possible to update a toast
> chunk partially using SnapshotToast ?

As things stand (with either SnapshotToast or the old SnapshotAny way)
it is never possible to update an individual toast value, either
partially or wholly.  All you can do is lay down a new toast value (with
a new identifying OID) and then delete the old one.

But I'm not sure that this is wrong, or fixable.  Trying to update part
of a toasted value is very much like wanting to update part of an
existing row in-place, which we cannot possibly do.  We have to lay down
a whole new row whenever any part of it is updated.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: tuptoaster.c must *not* use SnapshotAny
Next
From: Philip Warner
Date:
Subject: Re: Bug in pg_dump/restore -o