Re: foreign partition DDL regression tests

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: foreign partition DDL regression tests
Date: 2017-03-08 02:06:04
Message-ID: CA+Tgmoa0XLNZbcU+2ZvC0QxaPh3aUPUvFk88zc4t=6O0YhrJbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 7, 2017 at 7:14 AM, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
> Hi Amit,
> Thanks for adding testcases. Overall the testcases look good.
>
> The testcase is using ALTER TABLE to modify foreign table schema.
> Though this works, I think a better option is to use ALTER FOREIGN
> TABLE.
>
> Something not related to this patch but
> -- no attach partition validation occurs for foreign tables
> ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1);
>
> I am wondering whether we can improve this. For local tables, if a
> valid constraint equivalent to the partitioning condition is not
> present on the table being attached, it scans the data to verify
> partition conditions. But for a foreign table, we don't want to do
> that since the constraint is not guaranteed to be valid after the
> initial check. For a normal foreign table a user can set a constraint
> if s/he knows that that constraint will be honoured on the foreign
> server. Thus instead of saying that we do not validate data, we can
> refuse to attach a partition if corresponding check constraint is
> absent on the foreign table being attached. A user will then be forced
> to add that constraint if s/he is sure that the constraint will be
> obeyed on the foreign server.

I agree that we could do that, but what value would it have? It just
forces the user to spend two SQL commands doing what could otherwise
be done in one. And the first command might not be that obvious. I
think we should leave well enough alone.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-03-08 02:07:20 CREATE/ALTER ROLE PASSWORD ('value' USING 'method')
Previous Message Vaishnavi Prabakaran 2017-03-08 02:04:24 Re: PATCH: Batch/pipelining support for libpq