File: interfaces.sql

package info (click to toggle)
pglogical 2.4.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,236 kB
  • sloc: ansic: 39,239; sql: 4,466; perl: 693; makefile: 210; sh: 77
file content (49 lines) | stat: -rw-r--r-- 1,562 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

SELECT * FROM pglogical_regress_variables()
\gset

\c :provider_dsn
CREATE USER super2 SUPERUSER;

\c :subscriber_dsn
SELECT * FROM pglogical.alter_node_add_interface('test_provider', 'super2', (SELECT provider_dsn FROM pglogical_regress_variables()) || ' user=super2');

SELECT * FROM pglogical.alter_subscription_interface('test_subscription', 'super2');

DO $$
BEGIN
    FOR i IN 1..100 LOOP
        IF EXISTS (SELECT 1 FROM pglogical.show_subscription_status() WHERE status != 'down') THEN
            EXIT;
        END IF;
        PERFORM pg_sleep(0.1);
    END LOOP;
END;$$;

SELECT pg_sleep(0.1);
SELECT subscription_name, status, provider_node, replication_sets, forward_origins FROM pglogical.show_subscription_status();

\c :provider_dsn
SELECT plugin, slot_type, active FROM pg_replication_slots;
SELECT usename FROM pg_stat_replication WHERE application_name = 'test_subscription';

\c :subscriber_dsn
SELECT * FROM pglogical.alter_subscription_interface('test_subscription', 'test_provider');

DO $$
BEGIN
    FOR i IN 1..100 LOOP
        IF EXISTS (SELECT 1 FROM pglogical.show_subscription_status() WHERE status != 'down') THEN
            EXIT;
        END IF;
        PERFORM pg_sleep(0.1);
    END LOOP;
END;$$;

SELECT pg_sleep(0.1);
SELECT subscription_name, status, provider_node, replication_sets, forward_origins FROM pglogical.show_subscription_status();

\c :provider_dsn
DROP USER super2;
SELECT plugin, slot_type, active FROM pg_replication_slots;
SELECT usename FROM pg_stat_replication WHERE application_name = 'test_subscription';