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

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add a test for "cannot truncate foreign table"
Date: 2022-07-07 16:06:18
Message-ID: e57cad1e-82f0-aca7-7881-d27914e3f806@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

One idea is to create dummy FDW (like foreign_data.sql regression test does) not supporting TRUNCATE and use it for the test.

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"

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-07-07 16:17:40 System catalog documentation chapter
Previous Message Fujii Masao 2022-07-07 15:54:37 Re: Support TRUNCATE triggers on foreign tables