--- /dev/null
+listen_addresses = '*'
+max_connections = 20
+
+shared_preload_libraries = 'bdr'
+bdr.connections = 'node1, node2'
+
+bdr.node1_dsn = 'dbname=postgres'
+bdr.node1_local_dbname = 'regression'
+
+bdr.node2_dsn = 'dbname=regression'
+bdr.node2_local_dbname = 'postgres'
+
+bdr.permit_unsafe_ddl_commands = false
+
+track_commit_timestamp = on
+
+max_wal_senders = 10
+max_replication_slots = 10
+
+wal_level = 'logical'
+wal_keep_segments = 625 # roughly 9GB max
+
+hba_file = 'pg_hba.conf'
\ No newline at end of file
--- /dev/null
+SELECT pg_sleep(5);
+ pg_sleep
+----------
+
+(1 row)
+
+CREATE TABLE test_tbl(pk int primary key, dropping_col1 text, dropping_col2 text);
+ALTER TABLE test_tbl ADD COLUMN col1 text;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+---------------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ dropping_col1 | text | | extended | |
+ dropping_col2 | text | | extended | |
+ col1 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ADD COLUMN col2 text;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+---------------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ dropping_col1 | text | | extended | |
+ dropping_col2 | text | | extended | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ADD COLUMN serial_col_node1 SERIAL;
+ERROR: ALTER TABLE ... ADD COLUMN ... DEFAULT may only affect UNLOGGED or TEMPORARY tables when BDR is active; test_tbl is a regular table
+ALTER TABLE test_tbl DROP COLUMN dropping_col1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+---------------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ dropping_col2 | text | | extended | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl DROP COLUMN dropping_col2;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col1 DROP NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col2 DROP NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET DEFAULT 'abc';
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | default 'abc'::text | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET DEFAULT 'abc';
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | default 'abc'::text | extended | |
+ col2 | text | default 'abc'::text | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col1 DROP DEFAULT;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | default 'abc'::text | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col2 DROP DEFAULT;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ADD CONSTRAINT test_const CHECK (true);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Check constraints:
+ "test_const" CHECK (true)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ADD CONSTRAINT test_const1 CHECK (true);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Check constraints:
+ "test_const" CHECK (true)
+ "test_const1" CHECK (true)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl DROP CONSTRAINT test_const;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Check constraints:
+ "test_const1" CHECK (true)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl DROP CONSTRAINT test_const1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET NOT NULL;
+CREATE UNIQUE INDEX test_idx ON test_tbl(col1);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+ "test_idx" UNIQUE, btree (col1) REPLICA IDENTITY
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET NOT NULL;
+CREATE UNIQUE INDEX test_idx1 ON test_tbl(col2);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+ "test_idx" UNIQUE, btree (col1)
+ "test_idx1" UNIQUE, btree (col2) REPLICA IDENTITY
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+ALTER TABLE test_tbl REPLICA IDENTITY DEFAULT;
+DROP INDEX test_idx;
+DROP INDEX test_idx1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+CREATE UNIQUE INDEX test_idx ON test_tbl(col1);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+DROP INDEX test_idx;
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c regression
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+CREATE USER test_user;
+ALTER TABLE test_tbl OWNER TO test_user;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\c postgres
+\d+ test_tbl
+ Table "public.test_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+----------+--------------+-------------
+ pk | integer | not null | plain | |
+ col1 | text | not null | extended | |
+ col2 | text | not null | extended | |
+Indexes:
+ "test_tbl_pkey" PRIMARY KEY, btree (pk)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
--- /dev/null
+SELECT pg_sleep(10);
+ pg_sleep
+----------
+
+(1 row)
+
+CREATE TABLE test_tbl_simple_create(val int);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_simple_create
+ Table "public.test_tbl_simple_create"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_simple_create FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_simple_create
+ Table "public.test_tbl_simple_create"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_simple_create FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_tbl_simple_create;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_simple_create
+\c regression
+\d+ test_tbl_simple_create
+CREATE TABLE test_tbl_simple_pk(val int PRIMARY KEY);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_simple_pk
+ Table "public.test_tbl_simple_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | not null | plain | |
+Indexes:
+ "test_tbl_simple_pk_pkey" PRIMARY KEY, btree (val)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_simple_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_simple_pk
+ Table "public.test_tbl_simple_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | not null | plain | |
+Indexes:
+ "test_tbl_simple_pk_pkey" PRIMARY KEY, btree (val)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_simple_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_tbl_simple_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_simple_pk
+\c regression
+\d+ test_tbl_simple_pk
+CREATE TABLE test_tbl_combined_pk(val int, val1 int, PRIMARY KEY (val, val1));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_combined_pk
+ Table "public.test_tbl_combined_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | not null | plain | |
+ val1 | integer | not null | plain | |
+Indexes:
+ "test_tbl_combined_pk_pkey" PRIMARY KEY, btree (val, val1)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_combined_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_combined_pk
+ Table "public.test_tbl_combined_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | not null | plain | |
+ val1 | integer | not null | plain | |
+Indexes:
+ "test_tbl_combined_pk_pkey" PRIMARY KEY, btree (val, val1)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_combined_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_tbl_combined_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_combined_pk
+\c regression
+\d+ test_tbl_combined_pk
+CREATE TABLE test_tbl_serial(val SERIAL);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_serial
+ Table "public.test_tbl_serial"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_val_seq'::regclass) | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_serial
+ Table "public.test_tbl_serial"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_val_seq'::regclass) | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_tbl_serial;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_serial
+\c regression
+\d+ test_tbl_serial
+CREATE TABLE test_tbl_serial_pk(val SERIAL PRIMARY KEY);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_serial_pk
+ Table "public.test_tbl_serial_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+------------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_pk_val_seq'::regclass) | plain | |
+Indexes:
+ "test_tbl_serial_pk_pkey" PRIMARY KEY, btree (val)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_serial_pk
+ Table "public.test_tbl_serial_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+------------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_pk_val_seq'::regclass) | plain | |
+Indexes:
+ "test_tbl_serial_pk_pkey" PRIMARY KEY, btree (val)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_tbl_serial_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_serial_pk
+\c regression
+\d+ test_tbl_serial_pk
+CREATE TABLE test_tbl_serial_combined_pk(val SERIAL, val1 INTEGER, PRIMARY KEY (val, val1));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_serial_combined_pk
+ Table "public.test_tbl_serial_combined_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_combined_pk_val_seq'::regclass) | plain | |
+ val1 | integer | not null | plain | |
+Indexes:
+ "test_tbl_serial_combined_pk_pkey" PRIMARY KEY, btree (val, val1)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial_combined_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_serial_combined_pk
+ Table "public.test_tbl_serial_combined_pk"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+---------------------------------------------------------------------------+---------+--------------+-------------
+ val | integer | not null default nextval('test_tbl_serial_combined_pk_val_seq'::regclass) | plain | |
+ val1 | integer | not null | plain | |
+Indexes:
+ "test_tbl_serial_combined_pk_pkey" PRIMARY KEY, btree (val, val1)
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_serial_combined_pk FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+CREATE SEQUENCE test_seq USING bdr;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_seq
+ Sequence "public.test_seq"
+ Column | Type | Value | Storage
+---------------+---------+---------------------+----------
+ sequence_name | name | test_seq | plain
+ last_value | bigint | 1 | plain
+ start_value | bigint | 1 | plain
+ increment_by | bigint | 1 | plain
+ max_value | bigint | 9223372036854775807 | plain
+ min_value | bigint | 1 | plain
+ cache_value | bigint | 1 | plain
+ log_cnt | bigint | 0 | plain
+ is_cycled | boolean | f | plain
+ is_called | boolean | f | plain
+ amdata | bytea | | extended
+
+\c regression
+\d+ test_seq
+ Sequence "public.test_seq"
+ Column | Type | Value | Storage
+---------------+---------+---------------------+----------
+ sequence_name | name | test_seq | plain
+ last_value | bigint | 1 | plain
+ start_value | bigint | 1 | plain
+ increment_by | bigint | 1 | plain
+ max_value | bigint | 9223372036854775807 | plain
+ min_value | bigint | 1 | plain
+ cache_value | bigint | 1 | plain
+ log_cnt | bigint | 0 | plain
+ is_cycled | boolean | f | plain
+ is_called | boolean | f | plain
+ amdata | bytea | | extended
+
+DROP SEQUENCE test_seq;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_seq;
+\c postgres
+\d+ test_seq
+CREATE TABLE test_tbl_create_index (val int, val2 int);
+CREATE UNIQUE INDEX test1_idx ON test_tbl_create_index(val);
+CREATE INDEX test2_idx ON test_tbl_create_index (lower(val2::text));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Indexes:
+ "test1_idx" UNIQUE, btree (val)
+ "test2_idx" btree (lower(val2::text))
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c regression
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Indexes:
+ "test1_idx" UNIQUE, btree (val)
+ "test2_idx" btree (lower(val2::text))
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP INDEX test1_idx;
+DROP INDEX test2_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+CREATE INDEX test1_idx ON test_tbl_create_index(val, val2);
+CREATE INDEX test2_idx ON test_tbl_create_index USING gist (val, UPPER(val2::text));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Indexes:
+ "test1_idx" btree (val, val2)
+ "test2_idx" gist (val, upper(val2::text))
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c regression
+\d+ test_tbl_create_index
+ Table "public.test_tbl_create_index"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+---------+-----------+---------+--------------+-------------
+ val | integer | | plain | |
+ val2 | integer | | plain | |
+Indexes:
+ "test1_idx" btree (val, val2)
+ "test2_idx" gist (val, upper(val2::text))
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_tbl_create_index FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP INDEX test1_idx;
+DROP INDEX test2_idx;
+DROP TABLE test_tbl_create_index;
+CREATE TABLE test_simple_create_with_arrays_tbl(val int[], val1 text[]);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_simple_create_with_arrays_tbl
+ Table "public.test_simple_create_with_arrays_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+-----------+-----------+----------+--------------+-------------
+ val | integer[] | | extended | |
+ val1 | text[] | | extended | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_arrays_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c postgres
+\d+ test_simple_create_with_arrays_tbl
+ Table "public.test_simple_create_with_arrays_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+-----------+-----------+----------+--------------+-------------
+ val | integer[] | | extended | |
+ val1 | text[] | | extended | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_arrays_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_simple_create_with_arrays_tbl;
+CREATE TYPE test_t AS ENUM('a','b','c');
+CREATE TABLE test_simple_create_with_enums_tbl(val test_t, val1 test_t);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_simple_create_with_enums_tbl
+ Table "public.test_simple_create_with_enums_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+--------+-----------+---------+--------------+-------------
+ val | test_t | | plain | |
+ val1 | test_t | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_enums_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c regression
+\d+ test_simple_create_with_enums_tbl
+ Table "public.test_simple_create_with_enums_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+--------+-----------+---------+--------------+-------------
+ val | test_t | | plain | |
+ val1 | test_t | | plain | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_enums_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_simple_create_with_enums_tbl;
+DROP TYPE test_t;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_simple_create_with_enums_tbl
+\dT+ test_t
+ List of data types
+ Schema | Name | Internal name | Size | Elements | Access privileges | Description
+--------+------+---------------+------+----------+-------------------+-------------
+(0 rows)
+
+\c postgres
+\d+ test_simple_create_with_enums_tbl
+\dT+ test_t
+ List of data types
+ Schema | Name | Internal name | Size | Elements | Access privileges | Description
+--------+------+---------------+------+----------+-------------------+-------------
+(0 rows)
+
+CREATE TYPE test_t AS (f1 text, f2 float, f3 integer);
+CREATE TABLE test_simple_create_with_composites_tbl(val test_t, val1 test_t);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_simple_create_with_composites_tbl
+ Table "public.test_simple_create_with_composites_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+--------+-----------+----------+--------------+-------------
+ val | test_t | | extended | |
+ val1 | test_t | | extended | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_composites_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+\c regression
+\d+ test_simple_create_with_composites_tbl
+ Table "public.test_simple_create_with_composites_tbl"
+ Column | Type | Modifiers | Storage | Stats target | Description
+--------+--------+-----------+----------+--------------+-------------
+ val | test_t | | extended | |
+ val1 | test_t | | extended | |
+Triggers:
+ truncate_trigger AFTER TRUNCATE ON test_simple_create_with_composites_tbl FOR EACH STATEMENT EXECUTE PROCEDURE bdr.queue_truncate()
+
+DROP TABLE test_simple_create_with_composites_tbl;
+DROP TYPE test_t;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
+\d+ test_simple_create_with_composites_tbl
+\dT+ test_t
+ List of data types
+ Schema | Name | Internal name | Size | Elements | Access privileges | Description
+--------+------+---------------+------+----------+-------------------+-------------
+(0 rows)
+
+\c postgres
+\d+ test_simple_create_with_composites_tbl
+\dT+ test_t
+ List of data types
+ Schema | Name | Internal name | Size | Elements | Access privileges | Description
+--------+------+---------------+------+----------+-------------------+-------------
+(0 rows)
+
--- /dev/null
+# PostgreSQL Client Authentication Configuration File
+# ===================================================
+#
+# Refer to the "Client Authentication" section in the PostgreSQL
+# documentation for a complete description of this file. A short
+# synopsis follows.
+#
+# This file controls: which hosts are allowed to connect, how clients
+# are authenticated, which PostgreSQL user names they can use, which
+# databases they can access. Records take one of these forms:
+#
+# local DATABASE USER METHOD [OPTIONS]
+# host DATABASE USER ADDRESS METHOD [OPTIONS]
+# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
+# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
+#
+# (The uppercase items must be replaced by actual values.)
+#
+# The first field is the connection type: "local" is a Unix-domain
+# socket, "host" is either a plain or SSL-encrypted TCP/IP socket,
+# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a
+# plain TCP/IP socket.
+#
+# DATABASE can be "all", "sameuser", "samerole", "replication", a
+# database name, or a comma-separated list thereof. The "all"
+# keyword does not match "replication". Access to replication
+# must be enabled in a separate record (see example below).
+#
+# USER can be "all", a user name, a group name prefixed with "+", or a
+# comma-separated list thereof. In both the DATABASE and USER fields
+# you can also write a file name prefixed with "@" to include names
+# from a separate file.
+#
+# ADDRESS specifies the set of hosts the record matches. It can be a
+# host name, or it is made up of an IP address and a CIDR mask that is
+# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
+# specifies the number of significant bits in the mask. A host name
+# that starts with a dot (.) matches a suffix of the actual host name.
+# Alternatively, you can write an IP address and netmask in separate
+# columns to specify the set of hosts. Instead of a CIDR-address, you
+# can write "samehost" to match any of the server's own IP addresses,
+# or "samenet" to match any address in any subnet that the server is
+# directly connected to.
+#
+# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi",
+# "ident", "peer", "pam", "ldap", "radius" or "cert". Note that
+# "password" sends passwords in clear text; "md5" is preferred since
+# it sends encrypted passwords.
+#
+# OPTIONS are a set of options for the authentication in the format
+# NAME=VALUE. The available options depend on the different
+# authentication methods -- refer to the "Client Authentication"
+# section in the documentation for a list of which options are
+# available for which authentication methods.
+#
+# Database and user names containing spaces, commas, quotes and other
+# special characters must be quoted. Quoting one of the keywords
+# "all", "sameuser", "samerole" or "replication" makes the name lose
+# its special character, and just match a database or username with
+# that name.
+#
+# This file is read on server startup and when the postmaster receives
+# a SIGHUP signal. If you edit the file on a running system, you have
+# to SIGHUP the postmaster for the changes to take effect. You can
+# use "pg_ctl reload" to do that.
+
+# Put your actual configuration here
+# ----------------------------------
+#
+# If you want to allow non-local connections, you need to add more
+# "host" records. In that case you will also need to make PostgreSQL
+# listen on a non-local interface via the listen_addresses
+# configuration parameter, or via the -i or -h command line switches.
+
+# CAUTION: Configuring the system for local "trust" authentication
+# allows any local user to connect as any PostgreSQL user, including
+# the database superuser. If you do not trust all your local users,
+# use another authentication method.
+
+
+# TYPE DATABASE USER ADDRESS METHOD
+
+# "local" is for Unix domain socket connections only
+local all all trust
+# IPv4 local connections:
+host all all 127.0.0.1/32 trust
+# IPv6 local connections:
+host all all ::1/128 trust
+# Allow replication connections from localhost, by a user with the
+# replication privilege.
+local replication all trust
+host replication all 127.0.0.1/32 trust
+host replication all ::1/128 trust
--- /dev/null
+SELECT pg_sleep(5);
+
+CREATE TABLE test_tbl(pk int primary key, dropping_col1 text, dropping_col2 text);
+
+ALTER TABLE test_tbl ADD COLUMN col1 text;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ADD COLUMN col2 text;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ADD COLUMN serial_col_node1 SERIAL;
+
+ALTER TABLE test_tbl DROP COLUMN dropping_col1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl DROP COLUMN dropping_col2;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col1 DROP NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col2 DROP NOT NULL;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET DEFAULT 'abc';
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET DEFAULT 'abc';
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col1 DROP DEFAULT;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col2 DROP DEFAULT;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ADD CONSTRAINT test_const CHECK (true);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ADD CONSTRAINT test_const1 CHECK (true);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl DROP CONSTRAINT test_const;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl DROP CONSTRAINT test_const1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col1 SET NOT NULL;
+CREATE UNIQUE INDEX test_idx ON test_tbl(col1);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+ALTER TABLE test_tbl ALTER COLUMN col2 SET NOT NULL;
+CREATE UNIQUE INDEX test_idx1 ON test_tbl(col2);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c regression
+\d+ test_tbl
+
+ALTER TABLE test_tbl REPLICA IDENTITY DEFAULT;
+DROP INDEX test_idx;
+DROP INDEX test_idx1;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
+CREATE UNIQUE INDEX test_idx ON test_tbl(col1);
+ALTER TABLE test_tbl REPLICA IDENTITY USING INDEX test_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+DROP INDEX test_idx;
+\d+ test_tbl
+\c regression
+\d+ test_tbl
+
+CREATE USER test_user;
+ALTER TABLE test_tbl OWNER TO test_user;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\c postgres
+\d+ test_tbl
+
--- /dev/null
+SELECT pg_sleep(10);
+
+CREATE TABLE test_tbl_simple_create(val int);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_simple_create
+\c postgres
+\d+ test_tbl_simple_create
+
+DROP TABLE test_tbl_simple_create;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_simple_create
+\c regression
+\d+ test_tbl_simple_create
+
+
+CREATE TABLE test_tbl_simple_pk(val int PRIMARY KEY);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_simple_pk
+\c postgres
+\d+ test_tbl_simple_pk
+
+DROP TABLE test_tbl_simple_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_simple_pk
+\c regression
+\d+ test_tbl_simple_pk
+
+CREATE TABLE test_tbl_combined_pk(val int, val1 int, PRIMARY KEY (val, val1));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_combined_pk
+\c postgres
+\d+ test_tbl_combined_pk
+
+DROP TABLE test_tbl_combined_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_combined_pk
+\c regression
+\d+ test_tbl_combined_pk
+
+CREATE TABLE test_tbl_serial(val SERIAL);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_serial
+\c postgres
+\d+ test_tbl_serial
+
+DROP TABLE test_tbl_serial;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_serial
+\c regression
+\d+ test_tbl_serial
+
+CREATE TABLE test_tbl_serial_pk(val SERIAL PRIMARY KEY);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_serial_pk
+\c postgres
+\d+ test_tbl_serial_pk
+
+DROP TABLE test_tbl_serial_pk;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_serial_pk
+\c regression
+\d+ test_tbl_serial_pk
+
+CREATE TABLE test_tbl_serial_combined_pk(val SERIAL, val1 INTEGER, PRIMARY KEY (val, val1));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_serial_combined_pk
+\c postgres
+\d+ test_tbl_serial_combined_pk
+
+CREATE SEQUENCE test_seq USING bdr;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_seq
+\c regression
+\d+ test_seq
+
+DROP SEQUENCE test_seq;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_seq;
+\c postgres
+\d+ test_seq
+
+CREATE TABLE test_tbl_create_index (val int, val2 int);
+CREATE UNIQUE INDEX test1_idx ON test_tbl_create_index(val);
+CREATE INDEX test2_idx ON test_tbl_create_index (lower(val2::text));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_create_index
+\c regression
+\d+ test_tbl_create_index
+
+DROP INDEX test1_idx;
+DROP INDEX test2_idx;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_create_index
+\c postgres
+\d+ test_tbl_create_index
+
+CREATE INDEX test1_idx ON test_tbl_create_index(val, val2);
+CREATE INDEX test2_idx ON test_tbl_create_index USING gist (val, UPPER(val2::text));
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_tbl_create_index
+\c regression
+\d+ test_tbl_create_index
+
+DROP INDEX test1_idx;
+DROP INDEX test2_idx;
+DROP TABLE test_tbl_create_index;
+
+CREATE TABLE test_simple_create_with_arrays_tbl(val int[], val1 text[]);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_simple_create_with_arrays_tbl
+\c postgres
+\d+ test_simple_create_with_arrays_tbl
+
+DROP TABLE test_simple_create_with_arrays_tbl;
+
+CREATE TYPE test_t AS ENUM('a','b','c');
+CREATE TABLE test_simple_create_with_enums_tbl(val test_t, val1 test_t);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_simple_create_with_enums_tbl
+\c regression
+\d+ test_simple_create_with_enums_tbl
+
+DROP TABLE test_simple_create_with_enums_tbl;
+DROP TYPE test_t;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_simple_create_with_enums_tbl
+
+\dT+ test_t
+\c postgres
+\d+ test_simple_create_with_enums_tbl
+
+\dT+ test_t
+
+CREATE TYPE test_t AS (f1 text, f2 float, f3 integer);
+CREATE TABLE test_simple_create_with_composites_tbl(val test_t, val1 test_t);
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_simple_create_with_composites_tbl
+\c regression
+\d+ test_simple_create_with_composites_tbl
+
+DROP TABLE test_simple_create_with_composites_tbl;
+DROP TYPE test_t;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication;
+\d+ test_simple_create_with_composites_tbl
+
+\dT+ test_t
+\c postgres
+\d+ test_simple_create_with_composites_tbl
+
+\dT+ test_t
+
+
$(MAKE) -C $(top_builddir)/contrib/btree_gist
check: all | submake-regress submake-btree_gist regresscheck
+
+REGRESS_DDL_CHECKS=ddl/create ddl/alter_table
+
+regresscheck:
$(pg_regress_check) \
- --temp-config $(top_srcdir)/contrib/bdr/bdr.conf \
+ --temp-config $(top_srcdir)/contrib/bdr/bdr_ddlregress.conf \
--temp-install=./tmp_check \
--extra-install=contrib/btree_gist \
--extra-install=contrib/bdr \
- extension
+ $(REGRESS_DDL_CHECKS)
PHONY: submake-regress