Re: BUG #15552: Unexpected error in COPY to a foreign table in a transaction

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Luis Carril <luis(dot)carril(at)swarm64(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, PG Bug reporting form <noreply(at)postgresql(dot)org>
Subject: Re: BUG #15552: Unexpected error in COPY to a foreign table in a transaction
Date: 2018-12-19 00:44:42
Message-ID: 1c23a9b1-c9c0-a11a-63fc-d821602455ba@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Fujita-san,

On 2018/12/18 21:48, Etsuro Fujita wrote:
> FDWs would not look at heap_insert options, so another option would be to
> 1) leave that options as-is for foreign tables and 2) if the target is a
> foreign table, just skip heap_sync at the bottom of CopyFrom, or just
> return without doing anything in heap_sync.

I'd considered 2, but 1 might be better because it both fixes the problem
at hand and doesn't lead to misleadingly setting heap_insert options.

About adding guards in heap_sync itself to make sure that it becomes a
no-op for non-heap relations, I think that would make sense too.
Although, I wonder why it doesn't return without doing anything already,
given that it has this:

heap_sync(Relation rel)
{
/* non-WAL-logged tables never need fsync */
if (!RelationNeedsWAL(rel))
return;

where,

#define RelationNeedsWAL(relation) \
((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)

Maybe, we never paid enough attention to the semantics of repersistence
property of foreign tables, though I admit that that's not something we
should set out to fix on this thread.

Thanks,
Amit

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-12-19 00:57:12 Re: BUG #15558: NOTIFY max channel length is undocumented
Previous Message PG Bug reporting form 2018-12-19 00:28:35 BUG #15558: NOTIFY max channel length is undocumented