Skip to content

Commit 0e4e7f2

Browse files
committed
Fix some newly broken tests and docs
1 parent 509d79d commit 0e4e7f2

File tree

11 files changed

+173
-30
lines changed

11 files changed

+173
-30
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ Nodes can be added and removed dynamically using the SQL interfaces.
137137
- `subscription_name` - name of the subscription, must be unique
138138
- `provider_dsn` - connection string to a provider
139139
- `replication_sets` - array of replication sets to subscribe to, these must
140-
already exist, default is "default"
140+
already exist, default is "{default,default_insert_only}"
141141
- `synchronize_structure` - specifies if to synchronize structure from
142142
provider to the subscriber, default true
143143
- `synchronize_data` - specifies if to synchronize data from provider to
144144
the subscriber, default true
145145
- `forward_origins` - array of origin names to forward, currently only
146146
supported values are empty array meaning don't forward any changes
147-
that didn't originate on provider node, or "all" which means replicate all
148-
changes no matter what is their origin, default is "all"
147+
that didn't originate on provider node, or "{all}" which means replicate
148+
all changes no matter what is their origin, default is "{all}"
149149

150150
- `pglogical.pglogical_drop_subscription(subscription_name name, ifexists bool)`
151151
Disconnects the subscription and removes it from the catalog.

expected/foreign_key.out

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ $$);
2020
t
2121
(1 row)
2222

23+
SELECT * FROM pglogical.replication_set_add_table('default', 'f1k_products');
24+
replication_set_add_table
25+
---------------------------
26+
t
27+
(1 row)
28+
29+
SELECT * FROM pglogical.replication_set_add_table('default_insert_only', 'f1k_orders');
30+
replication_set_add_table
31+
---------------------------
32+
t
33+
(1 row)
34+
2335
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
2436
pg_xlog_wait_remote_apply
2537
---------------------------
@@ -57,9 +69,21 @@ SELECT * FROM public.f1k_orders;
5769

5870
\c regression
5971
SELECT pglogical.replicate_ddl_command($$
60-
DROP TABLE public.f1k_orders;
61-
DROP TABLE public.f1k_products;
72+
DROP TABLE public.f1k_orders CASCADE;
73+
DROP TABLE public.f1k_products CASCADE;
6274
$$);
75+
NOTICE: drop cascades to 1 other object
76+
DETAIL: table public.f1k_orders in replication set default_insert_only
77+
CONTEXT: during execution of queued SQL statement:
78+
DROP TABLE public.f1k_orders CASCADE;
79+
DROP TABLE public.f1k_products CASCADE;
80+
81+
NOTICE: drop cascades to 1 other object
82+
DETAIL: table public.f1k_products in replication set default
83+
CONTEXT: during execution of queued SQL statement:
84+
DROP TABLE public.f1k_orders CASCADE;
85+
DROP TABLE public.f1k_products CASCADE;
86+
6387
replicate_ddl_command
6488
-----------------------
6589
t

expected/functions.out

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ $$);
1818
t
1919
(1 row)
2020

21-
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
21+
SELECT * FROM pglogical.replication_set_add_table('default_insert_only', 'public.funct2');
22+
replication_set_add_table
23+
---------------------------
24+
t
25+
(1 row)
26+
27+
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
2228
pg_xlog_wait_remote_apply
2329
---------------------------
2430

2531
(1 row)
2632

2733
INSERT INTO public.funct2(a,b) VALUES (1,2);--c should be 22
2834
INSERT INTO public.funct2(a,b,c) VALUES (3,4,5);-- c should be 5
29-
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
35+
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), 0);
3036
pg_xlog_wait_remote_apply
3137
---------------------------
3238

@@ -57,6 +63,12 @@ $$);
5763
t
5864
(1 row)
5965

66+
SELECT * FROM pglogical.replication_set_add_all_tables('default_insert_only', '{public}');
67+
replication_set_add_all_tables
68+
--------------------------------
69+
t
70+
(1 row)
71+
6072
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
6173
pg_xlog_wait_remote_apply
6274
---------------------------
@@ -94,6 +106,12 @@ $$);
94106
t
95107
(1 row)
96108

109+
SELECT * FROM pglogical.replication_set_add_all_tables('default_insert_only', '{public}');
110+
replication_set_add_all_tables
111+
--------------------------------
112+
t
113+
(1 row)
114+
97115
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
98116
pg_xlog_wait_remote_apply
99117
---------------------------
@@ -150,6 +168,12 @@ $$);
150168
t
151169
(1 row)
152170

171+
SELECT * FROM pglogical.replication_set_add_table('default', 'nullcheck_tbl');
172+
replication_set_add_table
173+
---------------------------
174+
t
175+
(1 row)
176+
153177
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
154178
pg_xlog_wait_remote_apply
155179
---------------------------
@@ -232,6 +256,12 @@ $$);
232256
t
233257
(1 row)
234258

259+
SELECT * FROM pglogical.replication_set_add_table('default', 'not_nullcheck_tbl');
260+
replication_set_add_table
261+
---------------------------
262+
t
263+
(1 row)
264+
235265
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
236266
pg_xlog_wait_remote_apply
237267
---------------------------
@@ -334,15 +364,75 @@ SELECT * FROM public.not_nullcheck_tbl;
334364

335365
\c regression
336366
SELECT pglogical.replicate_ddl_command($$
337-
DROP TABLE public.funct;
367+
DROP TABLE public.funct CASCADE;
338368
DROP SEQUENCE public.INSERT_SEQ;
339-
DROP TABLE public.funct2;
340-
DROP TABLE public.funct5;
369+
DROP TABLE public.funct2 CASCADE;
370+
DROP TABLE public.funct5 CASCADE;
341371
DROP FUNCTION public.get_curr_century();
342372
DROP FUNCTION public.add(integer, integer);
343-
DROP TABLE public.nullcheck_tbl;
344-
DROP TABLE public.not_nullcheck_tbl;
373+
DROP TABLE public.nullcheck_tbl CASCADE;
374+
DROP TABLE public.not_nullcheck_tbl CASCADE;
345375
$$);
376+
NOTICE: drop cascades to 1 other object
377+
DETAIL: table public.funct in replication set default_insert_only
378+
CONTEXT: during execution of queued SQL statement:
379+
DROP TABLE public.funct CASCADE;
380+
DROP SEQUENCE public.INSERT_SEQ;
381+
DROP TABLE public.funct2 CASCADE;
382+
DROP TABLE public.funct5 CASCADE;
383+
DROP FUNCTION public.get_curr_century();
384+
DROP FUNCTION public.add(integer, integer);
385+
DROP TABLE public.nullcheck_tbl CASCADE;
386+
DROP TABLE public.not_nullcheck_tbl CASCADE;
387+
388+
NOTICE: drop cascades to 1 other object
389+
DETAIL: table public.funct2 in replication set default_insert_only
390+
CONTEXT: during execution of queued SQL statement:
391+
DROP TABLE public.funct CASCADE;
392+
DROP SEQUENCE public.INSERT_SEQ;
393+
DROP TABLE public.funct2 CASCADE;
394+
DROP TABLE public.funct5 CASCADE;
395+
DROP FUNCTION public.get_curr_century();
396+
DROP FUNCTION public.add(integer, integer);
397+
DROP TABLE public.nullcheck_tbl CASCADE;
398+
DROP TABLE public.not_nullcheck_tbl CASCADE;
399+
400+
NOTICE: drop cascades to 1 other object
401+
DETAIL: table public.funct5 in replication set default_insert_only
402+
CONTEXT: during execution of queued SQL statement:
403+
DROP TABLE public.funct CASCADE;
404+
DROP SEQUENCE public.INSERT_SEQ;
405+
DROP TABLE public.funct2 CASCADE;
406+
DROP TABLE public.funct5 CASCADE;
407+
DROP FUNCTION public.get_curr_century();
408+
DROP FUNCTION public.add(integer, integer);
409+
DROP TABLE public.nullcheck_tbl CASCADE;
410+
DROP TABLE public.not_nullcheck_tbl CASCADE;
411+
412+
NOTICE: drop cascades to 1 other object
413+
DETAIL: table public.nullcheck_tbl in replication set default
414+
CONTEXT: during execution of queued SQL statement:
415+
DROP TABLE public.funct CASCADE;
416+
DROP SEQUENCE public.INSERT_SEQ;
417+
DROP TABLE public.funct2 CASCADE;
418+
DROP TABLE public.funct5 CASCADE;
419+
DROP FUNCTION public.get_curr_century();
420+
DROP FUNCTION public.add(integer, integer);
421+
DROP TABLE public.nullcheck_tbl CASCADE;
422+
DROP TABLE public.not_nullcheck_tbl CASCADE;
423+
424+
NOTICE: drop cascades to 1 other object
425+
DETAIL: table public.not_nullcheck_tbl in replication set default
426+
CONTEXT: during execution of queued SQL statement:
427+
DROP TABLE public.funct CASCADE;
428+
DROP SEQUENCE public.INSERT_SEQ;
429+
DROP TABLE public.funct2 CASCADE;
430+
DROP TABLE public.funct5 CASCADE;
431+
DROP FUNCTION public.get_curr_century();
432+
DROP FUNCTION public.add(integer, integer);
433+
DROP TABLE public.nullcheck_tbl CASCADE;
434+
DROP TABLE public.not_nullcheck_tbl CASCADE;
435+
346436
replicate_ddl_command
347437
-----------------------
348438
t

expected/init.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ SELECT sync_kind, sync_subid, sync_nspname, sync_relname, sync_status FROM pglog
6060
(1 row)
6161

6262
SELECT * FROM pglogical.show_subscription_status();
63-
subscription_name | status | provider_node | provider_dsn | slot_name | replication_sets | forward_origins
64-
-------------------+-------------+---------------+------------------------------+--------------------------------------------+------------------+-----------------
65-
test_subscription | replicating | test_provider | dbname=regression user=super | pgl_postgres_test_provider_test_sube55bf37 | {default} |
63+
subscription_name | status | provider_node | provider_dsn | slot_name | replication_sets | forward_origins
64+
-------------------+-------------+---------------+------------------------------+--------------------------------------------+-------------------------------+-----------------
65+
test_subscription | replicating | test_provider | dbname=regression user=super | pgl_postgres_test_provider_test_sube55bf37 | {default,default_insert_only} |
6666
(1 row)
6767

6868
-- Make sure we see the slot and active connection

expected/matview.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ $$);
99
t
1010
(1 row)
1111

12-
SELECT * FROM pglogical.replication_set_add_table('default', 'test_tbl');
13-
replication_set_add_table
14-
---------------------------
12+
SELECT * FROM pglogical.replication_set_add_all_tables('default', '{public}');
13+
replication_set_add_all_tables
14+
--------------------------------
1515
t
1616
(1 row)
1717

expected/replication_set.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ SELECT pglogical.replicate_ddl_command($$
146146
DROP TABLE public.test_publicschema CASCADE;
147147
DROP SCHEMA normalschema CASCADE;
148148
DROP SCHEMA "strange.schema-IS" CASCADE;
149+
DROP TABLE public.test_nopkey CASCADE;
149150
$$);
150151
NOTICE: drop cascades to 2 other objects
151152
DETAIL: table public.test_publicschema in replication set repset_replicate_all
@@ -154,12 +155,14 @@ CONTEXT: during execution of queued SQL statement:
154155
DROP TABLE public.test_publicschema CASCADE;
155156
DROP SCHEMA normalschema CASCADE;
156157
DROP SCHEMA "strange.schema-IS" CASCADE;
158+
DROP TABLE public.test_nopkey CASCADE;
157159

158160
NOTICE: drop cascades to table normalschema.test_normalschema
159161
CONTEXT: during execution of queued SQL statement:
160162
DROP TABLE public.test_publicschema CASCADE;
161163
DROP SCHEMA normalschema CASCADE;
162164
DROP SCHEMA "strange.schema-IS" CASCADE;
165+
DROP TABLE public.test_nopkey CASCADE;
163166

164167
NOTICE: drop cascades to 2 other objects
165168
DETAIL: table normalschema.test_normalschema in replication set repset_replicate_instrunc
@@ -168,19 +171,31 @@ CONTEXT: during execution of queued SQL statement:
168171
DROP TABLE public.test_publicschema CASCADE;
169172
DROP SCHEMA normalschema CASCADE;
170173
DROP SCHEMA "strange.schema-IS" CASCADE;
174+
DROP TABLE public.test_nopkey CASCADE;
171175

172176
NOTICE: drop cascades to table "strange.schema-IS".test_strangeschema
173177
CONTEXT: during execution of queued SQL statement:
174178
DROP TABLE public.test_publicschema CASCADE;
175179
DROP SCHEMA normalschema CASCADE;
176180
DROP SCHEMA "strange.schema-IS" CASCADE;
181+
DROP TABLE public.test_nopkey CASCADE;
177182

178183
NOTICE: drop cascades to 1 other object
179184
DETAIL: table strange.schema-IS.test_strangeschema in replication set repset_replicate_insupd
180185
CONTEXT: during execution of queued SQL statement:
181186
DROP TABLE public.test_publicschema CASCADE;
182187
DROP SCHEMA normalschema CASCADE;
183188
DROP SCHEMA "strange.schema-IS" CASCADE;
189+
DROP TABLE public.test_nopkey CASCADE;
190+
191+
NOTICE: drop cascades to 2 other objects
192+
DETAIL: table public.test_nopkey in replication set repset_replicate_instrunc
193+
table public.test_nopkey in replication set default_insert_only
194+
CONTEXT: during execution of queued SQL statement:
195+
DROP TABLE public.test_publicschema CASCADE;
196+
DROP SCHEMA normalschema CASCADE;
197+
DROP SCHEMA "strange.schema-IS" CASCADE;
198+
DROP TABLE public.test_nopkey CASCADE;
184199

185200
replicate_ddl_command
186201
-----------------------

pglogical--1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ CREATE FUNCTION pglogical.drop_node(node_name name, ifexists boolean DEFAULT fal
4949
RETURNS boolean STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_drop_node';
5050

5151
CREATE FUNCTION pglogical.create_subscription(subscription_name name, provider_dsn text,
52-
replication_sets text[] = '{default}', synchronize_structure boolean = true, synchronize_data boolean = true,
53-
forward_origins text[] = '{all}')
52+
replication_sets text[] = '{default,default_insert_only}', synchronize_structure boolean = true,
53+
synchronize_data boolean = true, forward_origins text[] = '{all}')
5454
RETURNS oid STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_create_subscription';
5555
CREATE FUNCTION pglogical.drop_subscription(subscription_name name, ifexists boolean DEFAULT false)
5656
RETURNS oid STRICT VOLATILE LANGUAGE c AS 'MODULE_PATHNAME', 'pglogical_drop_subscription';

sql/foreign_key.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ CREATE TABLE public.f1k_orders (
1818
--pass
1919
$$);
2020

21+
SELECT * FROM pglogical.replication_set_add_table('default', 'f1k_products');
22+
SELECT * FROM pglogical.replication_set_add_table('default_insert_only', 'f1k_orders');
23+
2124
SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication;
2225

2326
INSERT into public.f1k_products VALUES (1, 1, 'product1', 1.20);
@@ -39,6 +42,6 @@ SELECT * FROM public.f1k_orders;
3942
\c regression
4043

4144
SELECT pglogical.replicate_ddl_command($$
42-
DROP TABLE public.f1k_orders;
43-
DROP TABLE public.f1k_products;
45+
DROP TABLE public.f1k_orders CASCADE;
46+
DROP TABLE public.f1k_products CASCADE;
4447
$$);

0 commit comments

Comments
 (0)