Alvaro Herrera <alvherre@commandprompt.com> writes:
> Simon Riggs wrote:
>> I think it is possible to detect this case without making catalog
>> entries, so I'll give this a try. Methinks that the truncate *must* be
>> the immediately preceding command, otherwise we might have a trigger
>> executing to put rows back into the table before we COPY.
> Hmm, is it possible to save the "is empty" info somewhere in local
> memory, perhaps the relcache (not necessarily propagated), and have
> heap_insert turn it off?
The relcache isn't a very safe place to store state --- it's a cache,
not stable storage.
However, I don't understand why Simon is on about "empty". ISTM the
important state is "new relfilenode assigned in this transaction".
regards, tom lane