CREATE EXTENSION IF NOT EXISTS postgres_fdw;
DROP SERVER IF EXISTS pg CASCADE;
CREATE SERVER pg FOREIGN DATA WRAPPER postgres_fdw
	OPTIONS (host 'localhost', dbname 'postgres');
CREATE USER MAPPING FOR public SERVER pg;

CREATE TABLE p (id int PRIMARY KEY, val text);

DROP FOREIGN TABLE IF EXISTS pf;
CREATE FOREIGN TABLE pf (id int, val text)
	SERVER pg
	OPTIONS (table_name 'p');

CREATE TABLE t AS SELECT i, md5(i::text) FROM generate_series(1,1000000) s(i);
VACUUM ANALYZE t;

CHECKPOINT;
