|
| 1 | +SELECT * FROM pglogical_regress_variables(); |
| 2 | + provider_dsn | subscriber_dsn |
| 3 | +--------------+---------------- |
| 4 | + regression | postgres |
| 5 | +(1 row) |
| 6 | + |
| 7 | +\gset |
| 8 | +\c :provider_dsn |
| 9 | +SET client_min_messages = 'warning'; |
| 10 | +DROP ROLE IF EXISTS nonreplica; |
| 11 | +CREATE USER nonreplica; |
| 12 | +CREATE EXTENSION IF NOT EXISTS pglogical; |
| 13 | +GRANT ALL ON SCHEMA pglogical TO nonreplica; |
| 14 | +GRANT ALL ON ALL TABLES IN SCHEMA pglogical TO nonreplica; |
| 15 | +\c :subscriber_dsn |
| 16 | +SET client_min_messages = 'warning'; |
| 17 | +CREATE EXTENSION IF NOT EXISTS pglogical; |
| 18 | +-- fail (local node not existing) |
| 19 | +SELECT * FROM pglogical.create_subscription( |
| 20 | + subscription_name := 'test_subscription', |
| 21 | + provider_dsn := 'dbname=regression user=nonreplica', |
| 22 | + forward_origins := '{}'); |
| 23 | +ERROR: local node not found |
| 24 | +-- succeed |
| 25 | +SELECT * FROM pglogical.create_node(node_name := 'test_subscriber', dsn := 'dbname=postgres user=nonreplica'); |
| 26 | + create_node |
| 27 | +------------- |
| 28 | + 1755434425 |
| 29 | +(1 row) |
| 30 | + |
| 31 | +-- fail (can't connect to remote) |
| 32 | +SELECT * FROM pglogical.create_subscription( |
| 33 | + subscription_name := 'test_subscription', |
| 34 | + provider_dsn := 'dbname=regression user=nonexisting', |
| 35 | + forward_origins := '{}'); |
| 36 | +ERROR: could not connect to the postgresql server: FATAL: role "nonexisting" does not exist |
| 37 | + |
| 38 | +DETAIL: dsn was: dbname=regression user=nonexisting fallback_application_name='create_subscription' |
| 39 | +-- fail (remote node not existing) |
| 40 | +SELECT * FROM pglogical.create_subscription( |
| 41 | + subscription_name := 'test_subscription', |
| 42 | + provider_dsn := 'dbname=regression user=nonreplica', |
| 43 | + forward_origins := '{}'); |
| 44 | +ERROR: could fetch remote node info: ERROR: local node not found |
| 45 | + |
| 46 | + |
| 47 | +\c :provider_dsn |
| 48 | +-- succeed |
| 49 | +SELECT * FROM pglogical.create_node(node_name := 'test_provider', dsn := 'dbname=postgres user=nonreplica'); |
| 50 | + create_node |
| 51 | +------------- |
| 52 | + 2689511696 |
| 53 | +(1 row) |
| 54 | + |
| 55 | +\c :subscriber_dsn |
| 56 | +-- fail (can't connect with replication connection to remote) |
| 57 | +SELECT * FROM pglogical.create_subscription( |
| 58 | + subscription_name := 'test_subscription', |
| 59 | + provider_dsn := 'dbname=regression user=nonreplica', |
| 60 | + forward_origins := '{}'); |
| 61 | +ERROR: could not connect to the postgresql server in replication mode: FATAL: must be superuser or replication role to start walsender |
| 62 | + |
| 63 | +DETAIL: dsn was: dbname=regression user=nonreplica replication=database fallback_application_name='create_subscription' |
| 64 | +-- cleanup |
| 65 | +SELECT * FROM pglogical.drop_node('test_subscriber'); |
| 66 | + drop_node |
| 67 | +----------- |
| 68 | + t |
| 69 | +(1 row) |
| 70 | + |
| 71 | +\c :provider_dsn |
| 72 | +SELECT * FROM pglogical.drop_node('test_provider'); |
| 73 | + drop_node |
| 74 | +----------- |
| 75 | + t |
| 76 | +(1 row) |
| 77 | + |
| 78 | +SET client_min_messages = 'warning'; |
| 79 | +DROP OWNED BY nonreplica; |
| 80 | +DROP ROLE IF EXISTS nonreplica; |
0 commit comments