Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT
Date
Msg-id 26360.1358265474@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Responses Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT
List pgsql-hackers
Gurjeet Singh <singh.gurjeet@gmail.com> writes:
> On Mon, Jan 14, 2013 at 10:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I think this is unacceptable on its face.  It essentially supposes that
>> relcache entries are reliable storage.  They are not.

> Would it be acceptable if we inverted the meaning of the struct member, and
> named it to  rd_rows_not_inserted. When registering an ON COMMIT action, we
> can set this member to true, and set it to false when inserting a row into
> it. The pre-commit hook will truncate any relation that doesn't have this
> member set to true.

> With that in place, even if the relcache entry is discarded midway through
> the transaction, the cleanup code will truncate the relation, preserving
> the correct behaviour.

Well, that would fail in the safe direction, but it just seems
excessively ugly and hard-to-understand.  Given the field demand for
this optimization (which so far as I've noticed is nil), I'm not
convinced we need to do this.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCH] COPY .. COMPRESSED
Next
From: Andres Freund
Date:
Subject: Re: Curious buildfarm failures