On 2017/03/09 1:28, Robert Haas wrote:
> On Tue, Feb 21, 2017 at 8:40 PM, Amit Langote
> <langote_amit...@lab.ntt.co.jp> wrote:
>> Ashutosh Bapat pointed out [0] that regression tests are missing for the
>> foreign partition DDL commands.  Attached patch takes care of that.
> 
> Committed.

Thanks.

> I didn't do anything about Ashutosh's comment that we could use ALTER
> FOREIGN TABLE rather than ALTER TABLE someplace; that didn't seem
> critical.

Attached is a patch to fix that, just in case.

> Also, the names of the objects in this test are kinda generic (pt2 et.
> al.) but they match the existing names in the same file (pt1, foo).
> If we're going to start differentiating those a little better, we
> should probably change them all, and as a separate commit.

Agreed.

Thanks,
Amit
>From f0467b30b74d2af72480bb20867164ef030f3c56 Mon Sep 17 00:00:00 2001
From: amit <amitlangot...@gmail.com>
Date: Thu, 9 Mar 2017 09:51:39 +0900
Subject: [PATCH] Use ALTER FOREIGN TABLE with foreign table in tests

---
 src/test/regress/expected/foreign_data.out | 8 ++++----
 src/test/regress/sql/foreign_data.sql      | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out
index a0f969f3e5..ea197c5e4f 100644
--- a/src/test/regress/expected/foreign_data.out
+++ b/src/test/regress/expected/foreign_data.out
@@ -1851,11 +1851,11 @@ Server: s0
 FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
 
 -- cannot add column to a partition
-ALTER TABLE pt2_1 ADD c4 char;
+ALTER FOREIGN TABLE pt2_1 ADD c4 char;
 ERROR:  cannot add column to a partition
 -- ok to have a partition's own constraints though
-ALTER TABLE pt2_1 ALTER c3 SET NOT NULL;
-ALTER TABLE pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> '');
+ALTER FOREIGN TABLE pt2_1 ALTER c3 SET NOT NULL;
+ALTER FOREIGN TABLE pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> '');
 \d+ pt2
                                     Table "public.pt2"
  Column |  Type   | Collation | Nullable | Default | Storage  | Stats target | Description 
@@ -1880,7 +1880,7 @@ Server: s0
 FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
 
 -- cannot drop inherited NOT NULL constraint from a partition
-ALTER TABLE pt2_1 ALTER c1 DROP NOT NULL;
+ALTER FOREIGN TABLE pt2_1 ALTER c1 DROP NOT NULL;
 ERROR:  column "c1" is marked NOT NULL in parent table
 -- partition must have parent's constraints
 ALTER TABLE pt2 DETACH PARTITION pt2_1;
diff --git a/src/test/regress/sql/foreign_data.sql b/src/test/regress/sql/foreign_data.sql
index c13d5ffbe9..8c5fcb8b35 100644
--- a/src/test/regress/sql/foreign_data.sql
+++ b/src/test/regress/sql/foreign_data.sql
@@ -720,16 +720,16 @@ ALTER TABLE pt2 ATTACH PARTITION pt2_1 FOR VALUES IN (1);
 \d+ pt2_1
 
 -- cannot add column to a partition
-ALTER TABLE pt2_1 ADD c4 char;
+ALTER FOREIGN TABLE pt2_1 ADD c4 char;
 
 -- ok to have a partition's own constraints though
-ALTER TABLE pt2_1 ALTER c3 SET NOT NULL;
-ALTER TABLE pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> '');
+ALTER FOREIGN TABLE pt2_1 ALTER c3 SET NOT NULL;
+ALTER FOREIGN TABLE pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> '');
 \d+ pt2
 \d+ pt2_1
 
 -- cannot drop inherited NOT NULL constraint from a partition
-ALTER TABLE pt2_1 ALTER c1 DROP NOT NULL;
+ALTER FOREIGN TABLE pt2_1 ALTER c1 DROP NOT NULL;
 
 -- partition must have parent's constraints
 ALTER TABLE pt2 DETACH PARTITION pt2_1;
-- 
2.11.0

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to