From: | Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Amit Langote <Langote_Amit_f8(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-18 12:48:59 |
Message-ID: | 5C18ECBB.2000507@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi Luis and Amit,
Thanks for the report, Luis! Thanks for the discussion, Amit!
(2018/12/18 12:24), Amit Langote wrote:
> On 2018/12/17 22:12, Luis Carril wrote:
>>> heap_sync should only be called for relations that actually have files to
>>> sync, which isn't true for foreign tables. So, a simple relkind check
>>> before calling heap_sync() in CopyFrom would suffice I think. Although,
>>> we might also need such a check higher up in CopyFrom where some
>>> optimizations that are specific to "heap" relations are enabled. For
>>> example, this piece of code:
>>
>> thanks for the input, so it seems that is enough with adding the check as you suggested:
>>
>> if (cstate->rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE&&
>> cstate->rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE&&
>> (cstate->rel->rd_createSubid != InvalidSubTransactionId ||
>> cstate->rel->rd_newRelfilenodeSubid != InvalidSubTransactionId))
>> {
>> hi_options |= HEAP_INSERT_SKIP_FSM;
>> if (!XLogIsNeeded())
>> hi_options |= HEAP_INSERT_SKIP_WAL;
>> }
>
> I think that would do the trick.
I think so too.
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.
Best regards,
Etsuro Fujita
From | Date | Subject | |
---|---|---|---|
Next Message | Hugh Ranalli | 2018-12-18 13:01:00 | Re: BUG #15548: Unaccent does not remove combining diacritical characters |
Previous Message | Michael Paquier | 2018-12-18 06:33:04 | Re: BUG #15548: Unaccent does not remove combining diacritical characters |