ifeq "@BUILDING_BDR@" "1"
check: regresscheck isolationcheck
-DDLREGRESSCHECKS=ddl/create ddl/alter_table ddl/extension ddl/function \
+DDLREGRESSCHECKS=ddl/enable_ddl ddl/create ddl/alter_table ddl/extension ddl/function \
ddl/grant ddl/mixed ddl/namespace ddl/replication_set \
- ddl/sequence ddl/view
+ ddl/sequence ddl/view ddl/disable_ddl
REGRESSINIT=init_bdr
else
check: regresscheck
NULL, NULL, NULL);
#endif
+ DefineCustomBoolVariable("bdr.permit_ddl_locking",
+ "Allow commands that can acquire the global "
+ "DDL lock",
+ NULL,
+ &bdr_permit_ddl_locking,
+ true, PGC_USERSET,
+ 0,
+ NULL, NULL, NULL);
+
DefineCustomBoolVariable("bdr.permit_unsafe_ddl_commands",
"Allow commands that might cause data or " \
"replication problems under BDR to run",
extern char *bdr_temp_dump_directory;
extern bool bdr_log_conflicts_to_table;
extern bool bdr_conflict_logging_include_tuples;
+extern bool bdr_permit_ddl_locking;
extern bool bdr_permit_unsafe_commands;
extern bool bdr_skip_ddl_locking;
#ifdef BUILDING_UDR
static bool this_xact_acquired_lock = false;
+/* GUCs */
+bool bdr_permit_ddl_locking = false;
+
static size_t
bdr_locks_shmem_size(void)
{
if (this_xact_acquired_lock)
return;
+ if (!bdr_permit_ddl_locking)
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("Global DDL locking attempt rejected by configuration"),
+ errdetail("bdr.permit_ddl_locking is false and the attempted command "
+ "would require the global DDL lock to be acquired. "
+ "Command rejected."),
+ errhint("See the 'DDL replication' chapter of the documentation.")));
+ }
+
initStringInfo(&s);
bdr_locks_find_my_database(false);
is modifying.</emphasis>
</para>
+ <para>
+ Because DDL is disruptive in &bdr;, transactions can't do DDL
+ that requires a heavy global lock by default. This is controlled
+ by the <xref linkend="guc-bdr-permit-ddl-locking"> setting. If
+ set to <literal>false</literal> (the default), any command that would
+ acquire the global DDL lock is rejected with an
+ <literal>ERROR</literal> instead. This helps prevent unintended global
+ DDL lock acquisitions.
+ </para>
+
<para>
To minimise the impact of DDL, transactions performing DDL should be short,
should not be combined with lots of row changes, and should avoid long
</listitem>
</varlistentry>
+ <varlistentry id="guc-bdr-permit-ddl-locking" xreflabel="bdr.permit_ddl_locking">
+ <term><varname>bdr.permit_ddl_locking</varname> (<type>boolean</type>)
+ <indexterm>
+ <primary><varname>bdr.permit_ddl_locking</varname> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Allow sessions to run DDL commands that acquire the global DDL lock. See
+ <xref linkend="ddl-replication"> for details on the DDL lock. Setting this
+ to off by default means that unintended DDL that can be disruptive to
+ production is prevented.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-bdr-permit-unsafe-ddl-commands" xreflabel="bdr.permit_unsafe_ddl_commands">
<term><varname>bdr.permit_unsafe_ddl_commands</varname> (<type>boolean</type>)
<indexterm>
--- /dev/null
+ALTER DATABASE regression RESET bdr.permit_ddl_locking;
+ALTER DATABASE postgres RESET bdr.permit_ddl_locking;
--- /dev/null
+SET bdr.permit_ddl_locking = false;
+CREATE TABLE should_fail ( id integer );
+ERROR: Global DDL locking attempt rejected by configuration
+DETAIL: bdr.permit_ddl_locking is false and the attempted command would require the global DDL lock to be acquired. Command rejected.
+HINT: See the 'DDL replication' chapter of the documentation.
+SET bdr.permit_ddl_locking = true;
+CREATE TABLE create_ok (id integer);
+SET bdr.permit_ddl_locking = false;
+ALTER TABLE create_ok ADD COLUMN alter_should_fail text;
+ERROR: Global DDL locking attempt rejected by configuration
+DETAIL: bdr.permit_ddl_locking is false and the attempted command would require the global DDL lock to be acquired. Command rejected.
+HINT: See the 'DDL replication' chapter of the documentation.
+SET bdr.permit_ddl_locking = true;
+DROP TABLE create_ok;
+-- Now for the rest of the DDL tests, presume they're allowed,
+-- otherwise they'll get pointlessly verbose.
+ALTER DATABASE regression SET bdr.permit_ddl_locking = true;
+ALTER DATABASE postgres SET bdr.permit_ddl_locking = true;
(4 rows)
DROP VIEW renamed_test_view;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
\d renamed_test_view
\c regression
\d renamed_test_view
CREATE VIEW test_view AS SELECT * FROM test_src_tbl;
DROP TABLE test_src_tbl CASCADE;
NOTICE: drop cascades to view test_view
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
+ pg_xlog_wait_remote_apply
+---------------------------
+
+
+(2 rows)
+
\d test_view
\c postgres
\d test_view
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.basic_dml (
id serial primary key,
(1 row)
+COMMIT;
-- check basic insert replication
INSERT INTO basic_dml(other, data, something)
VALUES (5, 'foo', '1 minute'::interval),
(4 rows)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.basic_dml;$$);
bdr_replicate_ddl_command
---------------------------
(1 row)
+COMMIT;
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE EXTENSION IF NOT EXISTS cube SCHEMA public;
CREATE EXTENSION IF NOT EXISTS hstore SCHEMA public;
(1 row)
+COMMIT;
-- check basic insert replication
INSERT INTO contrib_dml(fixed, variable)
VALUES ('(1,2)', 'a=>1,b=>2'),
(0 rows)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.contrib_dml;$$);
bdr_replicate_ddl_command
---------------------------
(1 row)
+COMMIT;
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.test (
id TEXT,
(1 row)
+COMMIT;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
pg_xlog_wait_remote_apply
---------------------------
(0 rows)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.test;$$);
bdr_replicate_ddl_command
---------------------------
(1 row)
+COMMIT;
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.tst_one_array (
a INTEGER PRIMARY KEY,
(1 row)
+COMMIT;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
pg_xlog_wait_remote_apply
---------------------------
(1 row)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
DROP TABLE public.tst_one_array;
DROP TABLE public.tst_arrays;
(1 row)
+COMMIT;
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.bdr_missing_pk_parent(a serial PRIMARY KEY);
CREATE TABLE public.bdr_missing_pk(a serial) INHERITS (public.bdr_missing_pk_parent);
(1 row)
+COMMIT;
INSERT INTO bdr_missing_pk SELECT generate_series(1, 10);
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
pg_xlog_wait_remote_apply
(0 rows)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.bdr_missing_pk CASCADE;$$);
NOTICE: drop cascades to view public.bdr_missing_pk_view
CONTEXT: during DDL replay of ddl statement: DROP TABLE public.bdr_missing_pk CASCADE;
(1 row)
+COMMIT;
SELECT * FROM public.bdr_regress_variables()
\gset
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.toasted (
id serial primary key,
(1 row)
+COMMIT;
-- check replication of toast values
INSERT INTO toasted(other, data) VALUES('foo', repeat('1234567890', 300));
-- check that unchanged toast values work correctly
(6 rows)
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.toasted;$$);
bdr_replicate_ddl_command
---------------------------
(1 row)
+COMMIT;
r | dbname=regression | dbname=postgres
(2 rows)
+SET bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($DDL$
CREATE OR REPLACE FUNCTION public.bdr_regress_variables(
OUT readdb1 text,
Parsed test spec with 2 sessions
-starting permutation: n1s1 n1sync n2read n1s2 n1sync n2read n1s3 n1s4 n1sync n2read n1s5 n1s6 n1sync n2read n1s7 n1sync n2read n1s8 n1s9 n1s10 n2s1 n2sync n1s11 n1sync n2sync n2read n1read n2s2 n2sync n1read
+starting permutation: n1setup n2setup n1s1 n1sync n2read n1s2 n1sync n2read n1s3 n1s4 n1sync n2read n1s5 n1s6 n1sync n2read n1s7 n1sync n2read n1s8 n1s9 n1s10 n2s1 n2sync n1s11 n1sync n2sync n2read n1read n2s2 n2sync n1read
+step n1setup: SET bdr.permit_ddl_locking = true;
+step n2setup: SET bdr.permit_ddl_locking = true;
step n1s1: INSERT INTO tst (a, b) VALUES (4, 'four');
step n1sync: SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
pg_xlog_wait_remote_apply
Parsed test spec with 3 sessions
-starting permutation: n1s1 n1sync n2reada n2readb n2readc n2s1 n2sync n3reada n3s1 n3sync n1readb n1s2 n1sync n2readc n2s2 n2sync n3reada n3readb n3s2 n3sync n1readb
+starting permutation: n1setup n2setup n1s1 n1sync n2reada n2readb n2readc n2s1 n2sync n3reada n3s1 n3sync n1readb n1s2 n1sync n2readc n2s2 n2sync n3reada n3readb n3s2 n3sync n1readb
+step n1setup: SET bdr.permit_ddl_locking = true;
+step n2setup: SET bdr.permit_ddl_locking = true;
step n1s1:
INSERT INTO tsta (a, b) VALUES
(1, ARRAY['aaa', 'bba', 'cca']),
Parsed test spec with 2 sessions
-starting permutation: s1b s1ct s2b s2ct s1c s2c s2dt s1wait s2wait s2ct2
-step s1b: BEGIN;
+starting permutation: s1b s1ct s2a s2b s2ct s1c s2c s2dt s1wait s2wait s2ct2
+step s1b: BEGIN; SET LOCAL bdr.permit_ddl_locking = true;
step s1ct: CREATE TABLE bdr_ddl_conflict_a(f1 int);
+step s2a: SET bdr.permit_ddl_locking = true;
step s2b: BEGIN;
step s2ct: CREATE TABLE bdr_ddl_conflict_b(f1 int);
ERROR: database is locked against ddl by another node
setup
{
+ SET bdr.permit_ddl_locking = true;
CREATE TABLE tst (a INTEGER PRIMARY KEY, b TEXT);
INSERT INTO tst (a, b) VALUES (1, 'one'), (2, 'two'), (3, 'three');
}
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE tst;
}
session "s1"
connection "node1"
+step "n1setup" { SET bdr.permit_ddl_locking = true; }
step "n1read" { SELECT * FROM tst ORDER BY a; }
step "n1sync" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; }
step "n1s1" { INSERT INTO tst (a, b) VALUES (4, 'four'); }
session "s2"
connection "node2"
+step "n2setup" { SET bdr.permit_ddl_locking = true; }
step "n2sync" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; }
step "n2read" { SELECT * FROM tst ORDER BY a; }
step "n2s1" { UPDATE tst SET c = 'changed' WHERE a = 1; }
step "n2s2" { UPDATE tst SET b = 'changed' WHERE a = 1; }
-permutation "n1s1" "n1sync" "n2read" "n1s2" "n1sync" "n2read" "n1s3" "n1s4" "n1sync" "n2read" "n1s5" "n1s6" "n1sync" "n2read" "n1s7" "n1sync" "n2read" "n1s8" "n1s9" "n1s10" "n2s1" "n2sync" "n1s11" "n1sync" "n2sync" "n2read" "n1read" "n2s2" "n2sync" "n1read"
+permutation "n1setup" "n2setup" "n1s1" "n1sync" "n2read" "n1s2" "n1sync" "n2read" "n1s3" "n1s4" "n1sync" "n2read" "n1s5" "n1s6" "n1sync" "n2read" "n1s7" "n1sync" "n2read" "n1s8" "n1s9" "n1s10" "n2s1" "n2sync" "n1s11" "n1sync" "n2sync" "n2read" "n1read" "n2s2" "n2sync" "n1read"
setup
{
+ SET bdr.permit_ddl_locking = true;
CREATE TABLE tsta (a INTEGER PRIMARY KEY, b TEXT[]);
CREATE TABLE tstb (a INTEGER PRIMARY KEY, b tstzrange);
CREATE TABLE tstc (a INTEGER PRIMARY KEY, b jsonb);
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE tsta;
DROP TABLE tstb;
DROP TABLE tstc;
session "s1"
connection "node1"
+step "n1setup" { SET bdr.permit_ddl_locking = true; }
step "n1sync" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; }
step "n1reada" { SELECT a, b FROM tsta ORDER BY a; }
step "n1readb" { SELECT a, b FROM tstb ORDER BY a; }
session "s2"
connection "node2"
+step "n2setup" { SET bdr.permit_ddl_locking = true; }
step "n2sync" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; }
step "n2reada" { SELECT a, b FROM tsta ORDER BY a; }
step "n2readb" { SELECT a, b FROM tstb ORDER BY a; }
(3, '[2003-03-03 03:03:03, 2003-04-05 03:03:03]');
}
-permutation "n1s1" "n1sync" "n2reada" "n2readb" "n2readc" "n2s1" "n2sync" "n3reada" "n3s1" "n3sync" "n1readb" "n1s2" "n1sync" "n2readc" "n2s2" "n2sync" "n3reada" "n3readb" "n3s2" "n3sync" "n1readb"
+permutation "n1setup" "n2setup" "n1s1" "n1sync" "n2reada" "n2readb" "n2readc" "n2s1" "n2sync" "n3reada" "n3s1" "n3sync" "n1readb" "n1s2" "n1sync" "n2readc" "n2s2" "n2sync" "n3reada" "n3readb" "n3s2" "n3sync" "n1readb"
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE IF EXISTS bdr_ddl_conflict_a, bdr_ddl_conflict_b, bdr_ddl_conflict_c;
}
session "snode1"
-step "s1b" { BEGIN; }
+step "s1b" { BEGIN; SET LOCAL bdr.permit_ddl_locking = true; }
step "s1ct" { CREATE TABLE bdr_ddl_conflict_a(f1 int); }
step "s1c" { COMMIT; }
step "s1wait" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; }
session "snode2"
+step "s2a" { SET bdr.permit_ddl_locking = true; }
step "s2b" { BEGIN; }
step "s2ct" { CREATE TABLE bdr_ddl_conflict_b(f1 int); }
step "s2c" { COMMIT; }
step "s2wait" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; select * from pg_sleep(1); }
step "s2ct2" { CREATE TABLE bdr_ddl_conflict_c(f1 int); }
-permutation "s1b" "s1ct" "s2b" "s2ct" "s1c" "s2c" "s2dt" "s1wait" "s2wait" "s2ct2"
+permutation "s1b" "s1ct" "s2a" "s2b" "s2ct" "s1c" "s2c" "s2dt" "s1wait" "s2wait" "s2ct2"
setup
{
BEGIN;
+ SET LOCAL bdr.permit_ddl_locking = true;
CREATE TABLE test_dmlconflict(a text, b int primary key, c text);
INSERT INTO test_dmlconflict VALUES('x', 1, 'foo');
COMMIT;
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE test_dmlconflict;
}
setup
{
BEGIN;
+ SET LOCAL bdr.permit_ddl_locking = true;
CREATE TABLE test_dmlconflict(a text, b int primary key, c text);
COMMIT;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE test_dmlconflict;
}
setup
{
BEGIN;
+ SET LOCAL bdr.permit_ddl_locking = true;
CREATE TABLE test_dmlconflict(a text, b int primary key, c text);
INSERT INTO test_dmlconflict VALUES('x', 1, 'foo');
COMMIT;
teardown
{
+ SET LOCAL bdr.permit_ddl_locking = true;
DROP TABLE test_dmlconflict;
}
setup
{
BEGIN;
+ SET LOCAL bdr.permit_ddl_locking = true;
CREATE TABLE test_dmlconflict(a text, b int primary key, c text);
INSERT INTO test_dmlconflict VALUES('x', 1, 'foo');
COMMIT;
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE test_dmlconflict;
}
setup
{
+ SET bdr.permit_ddl_locking = true;
CREATE TABLE tst (a INTEGER PRIMARY KEY, b TEXT);
INSERT INTO tst (a, b) VALUES (1, 'one');
}
teardown
{
+ SET bdr.permit_ddl_locking = true;
DROP TABLE tst;
}
--- /dev/null
+ALTER DATABASE regression RESET bdr.permit_ddl_locking;
+ALTER DATABASE postgres RESET bdr.permit_ddl_locking;
--- /dev/null
+SET bdr.permit_ddl_locking = false;
+CREATE TABLE should_fail ( id integer );
+
+SET bdr.permit_ddl_locking = true;
+CREATE TABLE create_ok (id integer);
+
+SET bdr.permit_ddl_locking = false;
+ALTER TABLE create_ok ADD COLUMN alter_should_fail text;
+
+SET bdr.permit_ddl_locking = true;
+DROP TABLE create_ok;
+
+-- Now for the rest of the DDL tests, presume they're allowed,
+-- otherwise they'll get pointlessly verbose.
+ALTER DATABASE regression SET bdr.permit_ddl_locking = true;
+ALTER DATABASE postgres SET bdr.permit_ddl_locking = true;
SELECT * FROM renamed_test_view;
DROP VIEW renamed_test_view;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
\d renamed_test_view
\c regression
\d renamed_test_view
CREATE VIEW test_view AS SELECT * FROM test_src_tbl;
DROP TABLE test_src_tbl CASCADE;
+SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
\d test_view
\c postgres
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.basic_dml (
id serial primary key,
something interval
);
$$);
+COMMIT;
-- check basic insert replication
INSERT INTO basic_dml(other, data, something)
SELECT id, other, data, something FROM basic_dml ORDER BY id;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.basic_dml;$$);
+COMMIT;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE EXTENSION IF NOT EXISTS cube SCHEMA public;
CREATE EXTENSION IF NOT EXISTS hstore SCHEMA public;
variable public.hstore
);
$$);
+COMMIT;
-- check basic insert replication
INSERT INTO contrib_dml(fixed, variable)
SELECT id, fixed, variable FROM contrib_dml ORDER BY id;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.contrib_dml;$$);
+COMMIT;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.test (
id TEXT,
PRIMARY KEY (id)
);
$$);
+COMMIT;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
SELECT id FROM test ORDER BY ts;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.test;$$);
+COMMIT;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.tst_one_array (
a INTEGER PRIMARY KEY,
c int8range[]
);
$$);
+COMMIT;
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
SELECT a, b, c FROM tst_range_array ORDER BY a;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
DROP TABLE public.tst_one_array;
DROP TABLE public.tst_arrays;
DROP TYPE public.tst_comp_basic_t;
DROP TYPE public.tst_enum_t;
$$);
+COMMIT;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.bdr_missing_pk_parent(a serial PRIMARY KEY);
CREATE TABLE public.bdr_missing_pk(a serial) INHERITS (public.bdr_missing_pk_parent);
CREATE VIEW public.bdr_missing_pk_view AS SELECT * FROM public.bdr_missing_pk;
$$);
+COMMIT;
INSERT INTO bdr_missing_pk SELECT generate_series(1, 10);
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
SELECT * FROM bdr_missing_pk;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.bdr_missing_pk CASCADE;$$);
+COMMIT;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$
CREATE TABLE public.toasted (
id serial primary key,
SELECT bdr.bdr_replicate_ddl_command($$
ALTER TABLE public.toasted ALTER COLUMN data SET STORAGE EXTERNAL;
$$);
+COMMIT;
-- check replication of toast values
INSERT INTO toasted(other, data) VALUES('foo', repeat('1234567890', 300));
SELECT * FROM toasted ORDER BY id;
\c :writedb1
+BEGIN;
+SET LOCAL bdr.permit_ddl_locking = true;
SELECT bdr.bdr_replicate_ddl_command($$DROP TABLE public.toasted;$$);
+COMMIT;
SELECT conn_dsn, conn_replication_sets FROM bdr.bdr_connections ORDER BY conn_dsn;
SELECT node_status, node_local_dsn, node_init_from_dsn FROM bdr.bdr_nodes ORDER BY node_local_dsn;
+SET bdr.permit_ddl_locking = true;
+
SELECT bdr.bdr_replicate_ddl_command($DDL$
CREATE OR REPLACE FUNCTION public.bdr_regress_variables(
OUT readdb1 text,