From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Luis Carril <luis.carril@swarm64.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Cc: PG Bug reporting form <noreply@postgresql.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Subject: Re: BUG #15552: Unexpected error in COPY to a foreign table in a transaction
Date: Wed, 19 Dec 2018 16:49:19 +0900
Message-ID: <5C19F7FF.9060904@lab.ntt.co.jp> (raw)
In-Reply-To: <6daa6d4a-d4a9-bd2c-0b84-c4e31d2b9844@lab.ntt.co.jp>
References: <15552-c64aa14c5c22f63c@postgresql.org>
<8e82d10d-cc16-eed4-7634-3654f59d8053@lab.ntt.co.jp>
<LEJPR01MB00109D0BECB8A961074A7CAFE7BC0@LEJPR01MB0010.DEUPRD01.PROD.OUTLOOK.DE>
<30718b48-8020-329a-c6f0-74e1222e5283@lab.ntt.co.jp>
<5C18ECBB.2000507@lab.ntt.co.jp>
<LEJPR01MB001074FD67CB65B539122E4DE7BD0@LEJPR01MB0010.DEUPRD01.PROD.OUTLOOK.DE>
<3539e73a-313a-5406-27c7-850affb47921@lab.ntt.co.jp>
<20181219023814.GA6577@paquier.xyz>
<6daa6d4a-d4a9-bd2c-0b84-c4e31d2b9844@lab.ntt.co.jp>
(2018/12/19 11:52), Amit Langote wrote:
> On 2018/12/19 11:38, Michael Paquier wrote:
>> I would rather not play with the semantics of heap_sync() on
>> the back branches as well as on a thread dealing with a bug about COPY
>> with foreign tables. Such discussions deserve a larger audience on
>> -hackers.
>
> +1
OK, I agree with that too.
> Patch looks good, by the way.
Thanks for working on this, Michael!
>> it is a bit funny to see COPY FREEZE working for foreign tables
>> actually, but perhaps this has some use-cases for some FDWs, so I'd
>> rather not touch it.
>
> Hmm, note that we don't pass CopyState->freeze option to the FDW drivers
> today, though we may in the future when we add an *actual* COPY interface
> to FDWs. Wouldn't it be a good idea to prevent specifying the FREEZE
> option for foreign tables as COPY targets until then?
Not sure. In general, I think it would be a good thing that the FDW is
able to see options specified in the COPY command, though.
> Of course, that's
> something for -hackers to consider.
Agreed.
BTW I noticed that this error occurs not only for foreign tables but for
views with INSTEAD OF INSERT triggers. Here is an example on HEAD:
postgres=# create table instead_of_insert_tbl(id serial, name text);
CREATE TABLE
postgres=# begin;
BEGIN
postgres=# create view instead_of_insert_tbl_view as select ''::text as str;
CREATE VIEW
postgres=# create function fun_instead_of_insert_tbl() returns trigger
as $$ beg
in insert into instead_of_insert_tbl (name) values (new.str); return
null; end;
$$ language plpgsql;
CREATE FUNCTION
postgres=# create trigger trig_instead_of_insert_tbl_view instead of
insert on i
nstead_of_insert_tbl_view for each row execute procedure
fun_instead_of_insert_t
bl();
CREATE TRIGGER
postgres=# copy instead_of_insert_tbl_view from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> test1
>> \.
ERROR: could not open file "base/13788/16426": そのようなファイルやディ
レクトリはありません
("そのようなファイルやディレクトリはありません" means no such file or
directory.)
To fix this I think we would also need the same treatment for the view case.
Best regards,
Etsuro Fujita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: fujita.etsuro@lab.ntt.co.jp, Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, luis.carril@swarm64.com, pgsql-bugs@lists.postgresql.org, noreply@postgresql.org, michael.paquier@gmail.com
Subject: Re: BUG #15552: Unexpected error in COPY to a foreign table in a transaction
In-Reply-To: <5C19F7FF.9060904@lab.ntt.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox