DROP EXTENSION IF EXISTS postgres_fdw CASCADE;
DROP TABLE test,t2_1 CASCADE;

CREATE EXTENSION postgres_fdw;
CREATE SERVER remote FOREIGN DATA WRAPPER postgres_fdw;
CREATE USER MAPPING FOR PUBLIC SERVER remote;
CREATE TABLE test(key int, x bigint) PARTITION BY LIST (key);
CREATE TABLE t1 PARTITION OF test FOR VALUES IN (1);
CREATE TABLE t2_1 (key int, x bigint);
CREATE FOREIGN TABLE t2 PARTITION OF test FOR VALUES IN (2) SERVER remote OPTIONS (table_name 't2_1');

INSERT INTO test (key, x) VALUES (1, -1);
INSERT INTO test (key, x) VALUES (2, 1);
