Re: Add a test for "cannot truncate foreign table"

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: masao(dot)fujii(at)oss(dot)nttdata(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add a test for "cannot truncate foreign table"
Date: 2022-07-08 02:07:44
Message-ID: 20220708110744.627fe4b8c52d05689ee9d34b@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 08 Jul 2022 09:44:10 +0900 (JST)
Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:

> At Fri, 8 Jul 2022 01:06:18 +0900, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote in
> >
> >
> > On 2022/07/08 0:33, Tom Lane wrote:
> > > Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> writes:
> > >> On 2022/06/30 10:48, Yugo NAGATA wrote:
> > >>> When a foreign table has handler but doesn't support TRUNCATE,
> > >>> an error "cannot truncate foreign table xxx" occurs. So, what
> > >>> about adding a test this message output? We can add this test
> > >>> for file_fdw because it is one of the such foreign data wrappers.
> > >
> > >> Thanks for the patch! It looks good to me.
> > >> I changed the status of this patch to ready-for-committer,
> > >> and will commit it barring any objeciton.
> > > This seems like a fairly pointless expenditure of test cycles
> > > to me. Perhaps more importantly, what will you do when
> > > somebody adds truncate support to that FDW?
>
> As Fujii-san mentioned below, file_fdw has tests for INSERT/UPDATE and
> DELETE. If somebody added DELETE to file_fdw, the test for DELETE
> rejection would be turned into a normal test of the DELETE function.
> I don't see a difference between TRUNCATE and other updating commands
> from this point of view.
>
> > One idea is to create dummy FDW (like foreign_data.sql regression test
> > does) not supporting TRUNCATE and use it for the test.
>
> I think the proposed test is not that for FDW framework, but for a
> specific FDW module, file_fdw.

Yes, the patch is an improvement for the test of flie_fdw.

If we want to test foreign table modifications for the FDW framework,
we will have to add such tests in foreign_data.sql, because foreign
table modifications are tested only for postgres_fdw and file_fdw.

> > BTW, file_fdw already has the similar test cases for INSERT, UPDATE
> > and DELETE, as follows.
> >
> > -- updates aren't supported
> > INSERT INTO agg_csv VALUES(1,2.0);
> > ERROR: cannot insert into foreign table "agg_csv"
> > UPDATE agg_csv SET a = 1;
> > ERROR: cannot update foreign table "agg_csv"
> > DELETE FROM agg_csv WHERE a = 100;
> > ERROR: cannot delete from foreign table "agg_csv"
>
> Agreed.
>
> regards.
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center

Regards,
Yugo Nagata

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2022-07-08 02:09:44 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message Kyotaro Horiguchi 2022-07-08 01:56:52 Re: remove more archiving overhead