mirror of
https://github.com/postgres/postgres.git
synced 2025-06-07 11:02:12 +03:00
Fix regression tests to use only global names beginning with "regress_".
In commit 18555b132 we tentatively established a rule that regression tests should use names containing "regression" for databases, and names starting with "regress_" for all other globally-visible object names, so as to circumscribe the side-effects that "make installcheck" could have on an existing installation. However, no enforcement mechanism was created, so it's unsurprising that some new violations have crept in since then. In fact, a whole new *category* of violations has crept in, to wit we now also have globally-visible subscription and replication origin names, and "make installcheck" could very easily clobber user-created objects of those types. So it's past time to do something about this. This commit sanitizes the tests enough that they will pass (i.e. not generate any visible warnings) with the enforcement mechanism I'll add in the next commit. There are some TAP tests that still trigger the warnings, but the warnings do not cause test failure. Since these tests do not actually run against a pre-existing installation, there's no need to worry whether they could conflict with user-created objects. The problem with rolenames.sql testing special role names like "user" is still there, and is dealt with only very cosmetically in this patch (by hiding the warnings :-(). What we actually need to do to be safe is to take that test script out of "make installcheck" altogether, but that seems like material for a separate patch. Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us
This commit is contained in:
parent
a1e61badf9
commit
ca129e58c0
@ -2,38 +2,38 @@
|
|||||||
SET synchronous_commit = on;
|
SET synchronous_commit = on;
|
||||||
CREATE TABLE origin_tbl(id serial primary key, data text);
|
CREATE TABLE origin_tbl(id serial primary key, data text);
|
||||||
CREATE TABLE target_tbl(id serial primary key, data text);
|
CREATE TABLE target_tbl(id serial primary key, data text);
|
||||||
SELECT pg_replication_origin_create('test_decoding: regression_slot');
|
SELECT pg_replication_origin_create('regress_test_decoding: regression_slot');
|
||||||
pg_replication_origin_create
|
pg_replication_origin_create
|
||||||
------------------------------
|
------------------------------
|
||||||
1
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- ensure duplicate creations fail
|
-- ensure duplicate creations fail
|
||||||
SELECT pg_replication_origin_create('test_decoding: regression_slot');
|
SELECT pg_replication_origin_create('regress_test_decoding: regression_slot');
|
||||||
ERROR: duplicate key value violates unique constraint "pg_replication_origin_roname_index"
|
ERROR: duplicate key value violates unique constraint "pg_replication_origin_roname_index"
|
||||||
DETAIL: Key (roname)=(test_decoding: regression_slot) already exists.
|
DETAIL: Key (roname)=(regress_test_decoding: regression_slot) already exists.
|
||||||
--ensure deletions work (once)
|
--ensure deletions work (once)
|
||||||
SELECT pg_replication_origin_create('test_decoding: temp');
|
SELECT pg_replication_origin_create('regress_test_decoding: temp');
|
||||||
pg_replication_origin_create
|
pg_replication_origin_create
|
||||||
------------------------------
|
------------------------------
|
||||||
2
|
2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('regress_test_decoding: temp');
|
||||||
pg_replication_origin_drop
|
pg_replication_origin_drop
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('regress_test_decoding: temp');
|
||||||
ERROR: replication origin "test_decoding: temp" does not exist
|
ERROR: replication origin "regress_test_decoding: temp" does not exist
|
||||||
-- various failure checks for undefined slots
|
-- various failure checks for undefined slots
|
||||||
select pg_replication_origin_advance('test_decoding: temp', '0/1');
|
select pg_replication_origin_advance('regress_test_decoding: temp', '0/1');
|
||||||
ERROR: replication origin "test_decoding: temp" does not exist
|
ERROR: replication origin "regress_test_decoding: temp" does not exist
|
||||||
select pg_replication_origin_session_setup('test_decoding: temp');
|
select pg_replication_origin_session_setup('regress_test_decoding: temp');
|
||||||
ERROR: replication origin "test_decoding: temp" does not exist
|
ERROR: replication origin "regress_test_decoding: temp" does not exist
|
||||||
select pg_replication_origin_progress('test_decoding: temp', true);
|
select pg_replication_origin_progress('regress_test_decoding: temp', true);
|
||||||
ERROR: replication origin "test_decoding: temp" does not exist
|
ERROR: replication origin "regress_test_decoding: temp" does not exist
|
||||||
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
||||||
?column?
|
?column?
|
||||||
----------
|
----------
|
||||||
@ -57,14 +57,14 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc
|
|||||||
|
|
||||||
INSERT INTO origin_tbl(data) VALUES ('will be replicated, but not decoded again');
|
INSERT INTO origin_tbl(data) VALUES ('will be replicated, but not decoded again');
|
||||||
-- mark session as replaying
|
-- mark session as replaying
|
||||||
SELECT pg_replication_origin_session_setup('test_decoding: regression_slot');
|
SELECT pg_replication_origin_session_setup('regress_test_decoding: regression_slot');
|
||||||
pg_replication_origin_session_setup
|
pg_replication_origin_session_setup
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- ensure we prevent duplicate setup
|
-- ensure we prevent duplicate setup
|
||||||
SELECT pg_replication_origin_session_setup('test_decoding: regression_slot');
|
SELECT pg_replication_origin_session_setup('regress_test_decoding: regression_slot');
|
||||||
ERROR: cannot setup replication origin when one is already setup
|
ERROR: cannot setup replication origin when one is already setup
|
||||||
SELECT '' FROM pg_logical_emit_message(false, 'test', 'this message will not be decoded');
|
SELECT '' FROM pg_logical_emit_message(false, 'test', 'this message will not be decoded');
|
||||||
?column?
|
?column?
|
||||||
@ -103,19 +103,19 @@ SELECT pg_replication_origin_session_reset();
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT local_id, external_id, remote_lsn, local_lsn <> '0/0' FROM pg_replication_origin_status;
|
SELECT local_id, external_id, remote_lsn, local_lsn <> '0/0' FROM pg_replication_origin_status;
|
||||||
local_id | external_id | remote_lsn | ?column?
|
local_id | external_id | remote_lsn | ?column?
|
||||||
----------+--------------------------------+------------+----------
|
----------+----------------------------------------+------------+----------
|
||||||
1 | test_decoding: regression_slot | 0/AABBCCDD | t
|
1 | regress_test_decoding: regression_slot | 0/AABBCCDD | t
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- check replication progress identified by name is correct
|
-- check replication progress identified by name is correct
|
||||||
SELECT pg_replication_origin_progress('test_decoding: regression_slot', false);
|
SELECT pg_replication_origin_progress('regress_test_decoding: regression_slot', false);
|
||||||
pg_replication_origin_progress
|
pg_replication_origin_progress
|
||||||
--------------------------------
|
--------------------------------
|
||||||
0/AABBCCDD
|
0/AABBCCDD
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_replication_origin_progress('test_decoding: regression_slot', true);
|
SELECT pg_replication_origin_progress('regress_test_decoding: regression_slot', true);
|
||||||
pg_replication_origin_progress
|
pg_replication_origin_progress
|
||||||
--------------------------------
|
--------------------------------
|
||||||
0/AABBCCDD
|
0/AABBCCDD
|
||||||
@ -146,7 +146,7 @@ SELECT pg_drop_replication_slot('regression_slot');
|
|||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT pg_replication_origin_drop('test_decoding: regression_slot');
|
SELECT pg_replication_origin_drop('regress_test_decoding: regression_slot');
|
||||||
pg_replication_origin_drop
|
pg_replication_origin_drop
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ CREATE FUNCTION exec(text) returns void language plpgsql volatile
|
|||||||
EXECUTE $1;
|
EXECUTE $1;
|
||||||
END;
|
END;
|
||||||
$f$;
|
$f$;
|
||||||
CREATE ROLE justforcomments NOLOGIN;
|
CREATE ROLE regress_justforcomments NOLOGIN;
|
||||||
SELECT exec(
|
SELECT exec(
|
||||||
format($outer$CREATE FUNCTION iamalongfunction() RETURNS TEXT IMMUTABLE LANGUAGE SQL AS $f$SELECT text %L$f$$outer$,
|
format($outer$CREATE FUNCTION iamalongfunction() RETURNS TEXT IMMUTABLE LANGUAGE SQL AS $f$SELECT text %L$f$$outer$,
|
||||||
(SELECT repeat(string_agg(to_char(g.i, 'FM0000'), ''), 50) FROM generate_series(1, 500) g(i))));
|
(SELECT repeat(string_agg(to_char(g.i, 'FM0000'), ''), 50) FROM generate_series(1, 500) g(i))));
|
||||||
@ -29,7 +29,7 @@ SELECT exec(
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT exec(
|
SELECT exec(
|
||||||
format($outer$COMMENT ON ROLE JUSTFORCOMMENTS IS %L$outer$,
|
format($outer$COMMENT ON ROLE REGRESS_JUSTFORCOMMENTS IS %L$outer$,
|
||||||
iamalongfunction()));
|
iamalongfunction()));
|
||||||
exec
|
exec
|
||||||
------
|
------
|
||||||
@ -161,4 +161,4 @@ SELECT pg_drop_replication_slot('regression_slot');
|
|||||||
DROP TABLE IF EXISTS replication_example;
|
DROP TABLE IF EXISTS replication_example;
|
||||||
DROP FUNCTION iamalongfunction();
|
DROP FUNCTION iamalongfunction();
|
||||||
DROP FUNCTION exec(text);
|
DROP FUNCTION exec(text);
|
||||||
DROP ROLE justforcomments;
|
DROP ROLE regress_justforcomments;
|
||||||
|
@ -4,19 +4,19 @@ SET synchronous_commit = on;
|
|||||||
CREATE TABLE origin_tbl(id serial primary key, data text);
|
CREATE TABLE origin_tbl(id serial primary key, data text);
|
||||||
CREATE TABLE target_tbl(id serial primary key, data text);
|
CREATE TABLE target_tbl(id serial primary key, data text);
|
||||||
|
|
||||||
SELECT pg_replication_origin_create('test_decoding: regression_slot');
|
SELECT pg_replication_origin_create('regress_test_decoding: regression_slot');
|
||||||
-- ensure duplicate creations fail
|
-- ensure duplicate creations fail
|
||||||
SELECT pg_replication_origin_create('test_decoding: regression_slot');
|
SELECT pg_replication_origin_create('regress_test_decoding: regression_slot');
|
||||||
|
|
||||||
--ensure deletions work (once)
|
--ensure deletions work (once)
|
||||||
SELECT pg_replication_origin_create('test_decoding: temp');
|
SELECT pg_replication_origin_create('regress_test_decoding: temp');
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('regress_test_decoding: temp');
|
||||||
SELECT pg_replication_origin_drop('test_decoding: temp');
|
SELECT pg_replication_origin_drop('regress_test_decoding: temp');
|
||||||
|
|
||||||
-- various failure checks for undefined slots
|
-- various failure checks for undefined slots
|
||||||
select pg_replication_origin_advance('test_decoding: temp', '0/1');
|
select pg_replication_origin_advance('regress_test_decoding: temp', '0/1');
|
||||||
select pg_replication_origin_session_setup('test_decoding: temp');
|
select pg_replication_origin_session_setup('regress_test_decoding: temp');
|
||||||
select pg_replication_origin_progress('test_decoding: temp', true);
|
select pg_replication_origin_progress('regress_test_decoding: temp', true);
|
||||||
|
|
||||||
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding');
|
||||||
|
|
||||||
@ -31,10 +31,10 @@ SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'inc
|
|||||||
INSERT INTO origin_tbl(data) VALUES ('will be replicated, but not decoded again');
|
INSERT INTO origin_tbl(data) VALUES ('will be replicated, but not decoded again');
|
||||||
|
|
||||||
-- mark session as replaying
|
-- mark session as replaying
|
||||||
SELECT pg_replication_origin_session_setup('test_decoding: regression_slot');
|
SELECT pg_replication_origin_session_setup('regress_test_decoding: regression_slot');
|
||||||
|
|
||||||
-- ensure we prevent duplicate setup
|
-- ensure we prevent duplicate setup
|
||||||
SELECT pg_replication_origin_session_setup('test_decoding: regression_slot');
|
SELECT pg_replication_origin_session_setup('regress_test_decoding: regression_slot');
|
||||||
|
|
||||||
SELECT '' FROM pg_logical_emit_message(false, 'test', 'this message will not be decoded');
|
SELECT '' FROM pg_logical_emit_message(false, 'test', 'this message will not be decoded');
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ SELECT pg_replication_origin_session_reset();
|
|||||||
SELECT local_id, external_id, remote_lsn, local_lsn <> '0/0' FROM pg_replication_origin_status;
|
SELECT local_id, external_id, remote_lsn, local_lsn <> '0/0' FROM pg_replication_origin_status;
|
||||||
|
|
||||||
-- check replication progress identified by name is correct
|
-- check replication progress identified by name is correct
|
||||||
SELECT pg_replication_origin_progress('test_decoding: regression_slot', false);
|
SELECT pg_replication_origin_progress('regress_test_decoding: regression_slot', false);
|
||||||
SELECT pg_replication_origin_progress('test_decoding: regression_slot', true);
|
SELECT pg_replication_origin_progress('regress_test_decoding: regression_slot', true);
|
||||||
|
|
||||||
-- ensure reset requires previously setup state
|
-- ensure reset requires previously setup state
|
||||||
SELECT pg_replication_origin_session_reset();
|
SELECT pg_replication_origin_session_reset();
|
||||||
@ -68,4 +68,4 @@ INSERT INTO origin_tbl(data) VALUES ('will be replicated');
|
|||||||
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'only-local', '1');
|
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'only-local', '1');
|
||||||
|
|
||||||
SELECT pg_drop_replication_slot('regression_slot');
|
SELECT pg_drop_replication_slot('regression_slot');
|
||||||
SELECT pg_replication_origin_drop('test_decoding: regression_slot');
|
SELECT pg_replication_origin_drop('regress_test_decoding: regression_slot');
|
||||||
|
@ -13,7 +13,7 @@ CREATE FUNCTION exec(text) returns void language plpgsql volatile
|
|||||||
EXECUTE $1;
|
EXECUTE $1;
|
||||||
END;
|
END;
|
||||||
$f$;
|
$f$;
|
||||||
CREATE ROLE justforcomments NOLOGIN;
|
CREATE ROLE regress_justforcomments NOLOGIN;
|
||||||
|
|
||||||
SELECT exec(
|
SELECT exec(
|
||||||
format($outer$CREATE FUNCTION iamalongfunction() RETURNS TEXT IMMUTABLE LANGUAGE SQL AS $f$SELECT text %L$f$$outer$,
|
format($outer$CREATE FUNCTION iamalongfunction() RETURNS TEXT IMMUTABLE LANGUAGE SQL AS $f$SELECT text %L$f$$outer$,
|
||||||
@ -22,7 +22,7 @@ SELECT exec(
|
|||||||
format($outer$COMMENT ON FUNCTION iamalongfunction() IS %L$outer$,
|
format($outer$COMMENT ON FUNCTION iamalongfunction() IS %L$outer$,
|
||||||
iamalongfunction()));
|
iamalongfunction()));
|
||||||
SELECT exec(
|
SELECT exec(
|
||||||
format($outer$COMMENT ON ROLE JUSTFORCOMMENTS IS %L$outer$,
|
format($outer$COMMENT ON ROLE REGRESS_JUSTFORCOMMENTS IS %L$outer$,
|
||||||
iamalongfunction()));
|
iamalongfunction()));
|
||||||
CREATE TABLE iamalargetable AS SELECT iamalongfunction() longfunctionoutput;
|
CREATE TABLE iamalargetable AS SELECT iamalongfunction() longfunctionoutput;
|
||||||
|
|
||||||
@ -104,4 +104,4 @@ SELECT pg_drop_replication_slot('regression_slot');
|
|||||||
DROP TABLE IF EXISTS replication_example;
|
DROP TABLE IF EXISTS replication_example;
|
||||||
DROP FUNCTION iamalongfunction();
|
DROP FUNCTION iamalongfunction();
|
||||||
DROP FUNCTION exec(text);
|
DROP FUNCTION exec(text);
|
||||||
DROP ROLE justforcomments;
|
DROP ROLE regress_justforcomments;
|
||||||
|
@ -22,29 +22,42 @@ $ENV{PGCLIENTENCODING} = 'LATIN1';
|
|||||||
# Create database and user names covering the range of LATIN1
|
# Create database and user names covering the range of LATIN1
|
||||||
# characters, for use in a connection string by pg_dumpall. Skip ','
|
# characters, for use in a connection string by pg_dumpall. Skip ','
|
||||||
# because of pg_regress --create-role, skip [\n\r] because pg_dumpall
|
# because of pg_regress --create-role, skip [\n\r] because pg_dumpall
|
||||||
# does not allow them.
|
# does not allow them. We also skip many ASCII letters, to keep the
|
||||||
|
# total number of tested characters to what will fit in four names.
|
||||||
|
# The odds of finding something interesting by testing all ASCII letters
|
||||||
|
# seem too small to justify the cycles of testing a fifth name.
|
||||||
my $dbname1 =
|
my $dbname1 =
|
||||||
generate_ascii_string(1, 9)
|
'regression'
|
||||||
|
. generate_ascii_string(1, 9)
|
||||||
. generate_ascii_string(11, 12)
|
. generate_ascii_string(11, 12)
|
||||||
. generate_ascii_string(14, 33)
|
. generate_ascii_string(14, 33)
|
||||||
. ($TestLib::windows_os ? '' : '"x"')
|
. ($TestLib::windows_os ? '' : '"x"') # IPC::Run mishandles '"' on Windows
|
||||||
. # IPC::Run mishandles '"' on Windows
|
. generate_ascii_string(35, 43) # skip ','
|
||||||
generate_ascii_string(35, 43)
|
. generate_ascii_string(45, 54);
|
||||||
. generate_ascii_string(45, 63); # contains '='
|
my $dbname2 = 'regression' . generate_ascii_string(55, 65) # skip 'B'-'W'
|
||||||
my $dbname2 =
|
. generate_ascii_string(88, 99) # skip 'd'-'w'
|
||||||
generate_ascii_string(67, 129); # skip 64-66 to keep length to 62
|
. generate_ascii_string(120, 149);
|
||||||
my $dbname3 = generate_ascii_string(130, 192);
|
my $dbname3 = 'regression' . generate_ascii_string(150, 202);
|
||||||
my $dbname4 = generate_ascii_string(193, 255);
|
my $dbname4 = 'regression' . generate_ascii_string(203, 255);
|
||||||
|
|
||||||
|
(my $username1 = $dbname1) =~ s/^regression/regress_/;
|
||||||
|
(my $username2 = $dbname2) =~ s/^regression/regress_/;
|
||||||
|
(my $username3 = $dbname3) =~ s/^regression/regress_/;
|
||||||
|
(my $username4 = $dbname4) =~ s/^regression/regress_/;
|
||||||
|
|
||||||
|
my $src_bootstrap_super = 'regress_postgres';
|
||||||
|
my $dst_bootstrap_super = 'boot';
|
||||||
|
|
||||||
my $node = get_new_node('main');
|
my $node = get_new_node('main');
|
||||||
$node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]);
|
$node->init(extra =>
|
||||||
|
[ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||||
|
|
||||||
# prep pg_hba.conf and pg_ident.conf
|
# prep pg_hba.conf and pg_ident.conf
|
||||||
$node->run_log(
|
$node->run_log(
|
||||||
[
|
[
|
||||||
$ENV{PG_REGRESS}, '--config-auth',
|
$ENV{PG_REGRESS}, '--config-auth',
|
||||||
$node->data_dir, '--create-role',
|
$node->data_dir, '--create-role',
|
||||||
"$dbname1,$dbname2,$dbname3,$dbname4"
|
"$username1,$username2,$username3,$username4"
|
||||||
]);
|
]);
|
||||||
$node->start;
|
$node->start;
|
||||||
|
|
||||||
@ -53,11 +66,18 @@ my $discard = "$backupdir/discard.sql";
|
|||||||
my $plain = "$backupdir/plain.sql";
|
my $plain = "$backupdir/plain.sql";
|
||||||
my $dirfmt = "$backupdir/dirfmt";
|
my $dirfmt = "$backupdir/dirfmt";
|
||||||
|
|
||||||
foreach my $dbname ($dbname1, $dbname2, $dbname3, $dbname4, 'CamelCase')
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, $dbname1 ]);
|
||||||
{
|
$node->run_log(
|
||||||
$node->run_log([ 'createdb', $dbname ]);
|
[ 'createuser', '-U', $src_bootstrap_super, '-s', $username1 ]);
|
||||||
$node->run_log([ 'createuser', '-s', $dbname ]);
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, $dbname2 ]);
|
||||||
}
|
$node->run_log(
|
||||||
|
[ 'createuser', '-U', $src_bootstrap_super, '-s', $username2 ]);
|
||||||
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, $dbname3 ]);
|
||||||
|
$node->run_log(
|
||||||
|
[ 'createuser', '-U', $src_bootstrap_super, '-s', $username3 ]);
|
||||||
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, $dbname4 ]);
|
||||||
|
$node->run_log(
|
||||||
|
[ 'createuser', '-U', $src_bootstrap_super, '-s', $username4 ]);
|
||||||
|
|
||||||
|
|
||||||
# For these tests, pg_dumpall -r is used because it produces a short
|
# For these tests, pg_dumpall -r is used because it produces a short
|
||||||
@ -66,98 +86,109 @@ $node->command_ok(
|
|||||||
[
|
[
|
||||||
'pg_dumpall', '-r', '-f', $discard, '--dbname',
|
'pg_dumpall', '-r', '-f', $discard, '--dbname',
|
||||||
$node->connstr($dbname1),
|
$node->connstr($dbname1),
|
||||||
'-U', $dbname4
|
'-U', $username4
|
||||||
],
|
],
|
||||||
'pg_dumpall with long ASCII name 1');
|
'pg_dumpall with long ASCII name 1');
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[
|
[
|
||||||
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
||||||
$node->connstr($dbname2),
|
$node->connstr($dbname2),
|
||||||
'-U', $dbname3
|
'-U', $username3
|
||||||
],
|
],
|
||||||
'pg_dumpall with long ASCII name 2');
|
'pg_dumpall with long ASCII name 2');
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[
|
[
|
||||||
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
||||||
$node->connstr($dbname3),
|
$node->connstr($dbname3),
|
||||||
'-U', $dbname2
|
'-U', $username2
|
||||||
],
|
],
|
||||||
'pg_dumpall with long ASCII name 3');
|
'pg_dumpall with long ASCII name 3');
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[
|
[
|
||||||
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
'pg_dumpall', '--no-sync', '-r', '-f', $discard, '--dbname',
|
||||||
$node->connstr($dbname4),
|
$node->connstr($dbname4),
|
||||||
'-U', $dbname1
|
'-U', $username1
|
||||||
],
|
],
|
||||||
'pg_dumpall with long ASCII name 4');
|
'pg_dumpall with long ASCII name 4');
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[ 'pg_dumpall', '--no-sync', '-r', '-l', 'dbname=template1' ],
|
[
|
||||||
|
'pg_dumpall', '-U',
|
||||||
|
$src_bootstrap_super, '--no-sync',
|
||||||
|
'-r', '-l',
|
||||||
|
'dbname=template1'
|
||||||
|
],
|
||||||
'pg_dumpall -l accepts connection string');
|
'pg_dumpall -l accepts connection string');
|
||||||
|
|
||||||
$node->run_log([ 'createdb', "foo\n\rbar" ]);
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, "foo\n\rbar" ]);
|
||||||
|
|
||||||
# not sufficient to use -r here
|
# not sufficient to use -r here
|
||||||
$node->command_fails(
|
$node->command_fails(
|
||||||
[ 'pg_dumpall', '--no-sync', '-f', $discard ],
|
[ 'pg_dumpall', '-U', $src_bootstrap_super, '--no-sync', '-f', $discard ],
|
||||||
'pg_dumpall with \n\r in database name');
|
'pg_dumpall with \n\r in database name');
|
||||||
$node->run_log([ 'dropdb', "foo\n\rbar" ]);
|
$node->run_log([ 'dropdb', '-U', $src_bootstrap_super, "foo\n\rbar" ]);
|
||||||
|
|
||||||
|
|
||||||
# make a table, so the parallel worker has something to dump
|
# make a table, so the parallel worker has something to dump
|
||||||
$node->safe_psql($dbname1, 'CREATE TABLE t0()');
|
$node->safe_psql(
|
||||||
|
$dbname1,
|
||||||
|
'CREATE TABLE t0()',
|
||||||
|
extra_params => [ '-U', $src_bootstrap_super ]);
|
||||||
|
|
||||||
# XXX no printed message when this fails, just SIGPIPE termination
|
# XXX no printed message when this fails, just SIGPIPE termination
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[
|
[
|
||||||
'pg_dump', '-Fd', '--no-sync', '-j2', '-f', $dirfmt, '-U', $dbname1,
|
'pg_dump', '-Fd', '--no-sync', '-j2', '-f', $dirfmt, '-U', $username1,
|
||||||
$node->connstr($dbname1)
|
$node->connstr($dbname1)
|
||||||
],
|
],
|
||||||
'parallel dump');
|
'parallel dump');
|
||||||
|
|
||||||
# recreate $dbname1 for restore test
|
# recreate $dbname1 for restore test
|
||||||
$node->run_log([ 'dropdb', $dbname1 ]);
|
$node->run_log([ 'dropdb', '-U', $src_bootstrap_super, $dbname1 ]);
|
||||||
$node->run_log([ 'createdb', $dbname1 ]);
|
$node->run_log([ 'createdb', '-U', $src_bootstrap_super, $dbname1 ]);
|
||||||
|
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[ 'pg_restore', '-v', '-d', 'template1', '-j2', '-U', $dbname1, $dirfmt ],
|
[
|
||||||
|
'pg_restore', '-v', '-d', 'template1',
|
||||||
|
'-j2', '-U', $username1, $dirfmt
|
||||||
|
],
|
||||||
'parallel restore');
|
'parallel restore');
|
||||||
|
|
||||||
$node->run_log([ 'dropdb', $dbname1 ]);
|
$node->run_log([ 'dropdb', '-U', $src_bootstrap_super, $dbname1 ]);
|
||||||
|
|
||||||
$node->command_ok(
|
$node->command_ok(
|
||||||
[
|
[
|
||||||
'pg_restore', '-C', '-v', '-d',
|
'pg_restore', '-C', '-v', '-d',
|
||||||
'template1', '-j2', '-U', $dbname1,
|
'template1', '-j2', '-U', $username1,
|
||||||
$dirfmt
|
$dirfmt
|
||||||
],
|
],
|
||||||
'parallel restore with create');
|
'parallel restore with create');
|
||||||
|
|
||||||
|
|
||||||
$node->command_ok([ 'pg_dumpall', '--no-sync', '-f', $plain, '-U', $dbname1 ],
|
$node->command_ok(
|
||||||
|
[ 'pg_dumpall', '--no-sync', '-f', $plain, '-U', $username1 ],
|
||||||
'take full dump');
|
'take full dump');
|
||||||
system_log('cat', $plain);
|
system_log('cat', $plain);
|
||||||
my ($stderr, $result);
|
my ($stderr, $result);
|
||||||
my $bootstrap_super = 'boot';
|
my $restore_super = qq{regress_a'b\\c=d\\ne"f};
|
||||||
my $restore_super = qq{a'b\\c=d\\ne"f};
|
|
||||||
|
|
||||||
|
|
||||||
# Restore full dump through psql using environment variables for
|
# Restore full dump through psql using environment variables for
|
||||||
# dbname/user connection parameters
|
# dbname/user connection parameters
|
||||||
|
|
||||||
my $envar_node = get_new_node('destination_envar');
|
my $envar_node = get_new_node('destination_envar');
|
||||||
$envar_node->init(
|
$envar_node->init(extra =>
|
||||||
extra => [ '-U', $bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||||
$envar_node->run_log(
|
$envar_node->run_log(
|
||||||
[
|
[
|
||||||
$ENV{PG_REGRESS}, '--config-auth',
|
$ENV{PG_REGRESS}, '--config-auth',
|
||||||
$envar_node->data_dir, '--create-role',
|
$envar_node->data_dir, '--create-role',
|
||||||
"$bootstrap_super,$restore_super"
|
"$dst_bootstrap_super,$restore_super"
|
||||||
]);
|
]);
|
||||||
$envar_node->start;
|
$envar_node->start;
|
||||||
|
|
||||||
# make superuser for restore
|
# make superuser for restore
|
||||||
$envar_node->run_log(
|
$envar_node->run_log(
|
||||||
[ 'createuser', '-U', $bootstrap_super, '-s', $restore_super ]);
|
[ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]);
|
||||||
|
|
||||||
{
|
{
|
||||||
local $ENV{PGPORT} = $envar_node->port;
|
local $ENV{PGPORT} = $envar_node->port;
|
||||||
@ -177,17 +208,17 @@ is($stderr, '', 'no dump errors');
|
|||||||
$restore_super =~ s/"//g
|
$restore_super =~ s/"//g
|
||||||
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
|
if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows
|
||||||
my $cmdline_node = get_new_node('destination_cmdline');
|
my $cmdline_node = get_new_node('destination_cmdline');
|
||||||
$cmdline_node->init(
|
$cmdline_node->init(extra =>
|
||||||
extra => [ '-U', $bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
|
||||||
$cmdline_node->run_log(
|
$cmdline_node->run_log(
|
||||||
[
|
[
|
||||||
$ENV{PG_REGRESS}, '--config-auth',
|
$ENV{PG_REGRESS}, '--config-auth',
|
||||||
$cmdline_node->data_dir, '--create-role',
|
$cmdline_node->data_dir, '--create-role',
|
||||||
"$bootstrap_super,$restore_super"
|
"$dst_bootstrap_super,$restore_super"
|
||||||
]);
|
]);
|
||||||
$cmdline_node->start;
|
$cmdline_node->start;
|
||||||
$cmdline_node->run_log(
|
$cmdline_node->run_log(
|
||||||
[ 'createuser', '-U', $bootstrap_super, '-s', $restore_super ]);
|
[ 'createuser', '-U', $dst_bootstrap_super, '-s', $restore_super ]);
|
||||||
{
|
{
|
||||||
$result = run_log(
|
$result = run_log(
|
||||||
[
|
[
|
||||||
|
@ -159,9 +159,9 @@ dbname1=`awk 'BEGIN { for (i= 1; i < 46; i++)
|
|||||||
dbname1='\"\'$dbname1'\\"\\\'
|
dbname1='\"\'$dbname1'\\"\\\'
|
||||||
dbname2=`awk 'BEGIN { for (i = 46; i < 91; i++) printf "%c", i }' </dev/null`
|
dbname2=`awk 'BEGIN { for (i = 46; i < 91; i++) printf "%c", i }' </dev/null`
|
||||||
dbname3=`awk 'BEGIN { for (i = 91; i < 128; i++) printf "%c", i }' </dev/null`
|
dbname3=`awk 'BEGIN { for (i = 91; i < 128; i++) printf "%c", i }' </dev/null`
|
||||||
createdb "$dbname1" || createdb_status=$?
|
createdb "regression$dbname1" || createdb_status=$?
|
||||||
createdb "$dbname2" || createdb_status=$?
|
createdb "regression$dbname2" || createdb_status=$?
|
||||||
createdb "$dbname3" || createdb_status=$?
|
createdb "regression$dbname3" || createdb_status=$?
|
||||||
|
|
||||||
if "$MAKE" -C "$oldsrc" installcheck-parallel; then
|
if "$MAKE" -C "$oldsrc" installcheck-parallel; then
|
||||||
oldpgversion=`psql -X -A -t -d regression -c "SHOW server_version_num"`
|
oldpgversion=`psql -X -A -t -d regression -c "SHOW server_version_num"`
|
||||||
|
@ -43,7 +43,7 @@ CREATE TRANSFORM FOR int LANGUAGE SQL (
|
|||||||
FROM SQL WITH FUNCTION prsd_lextype(internal),
|
FROM SQL WITH FUNCTION prsd_lextype(internal),
|
||||||
TO SQL WITH FUNCTION int4recv(internal));
|
TO SQL WITH FUNCTION int4recv(internal));
|
||||||
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
|
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
|
||||||
CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
||||||
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
||||||
-- test some error cases
|
-- test some error cases
|
||||||
@ -425,7 +425,7 @@ WITH objects (type, name, args) AS (VALUES
|
|||||||
('access method', '{btree}', '{}'),
|
('access method', '{btree}', '{}'),
|
||||||
('publication', '{addr_pub}', '{}'),
|
('publication', '{addr_pub}', '{}'),
|
||||||
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
|
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
|
||||||
('subscription', '{addr_sub}', '{}'),
|
('subscription', '{regress_addr_sub}', '{}'),
|
||||||
('statistics object', '{addr_nsp, gentable_stat}', '{}')
|
('statistics object', '{addr_nsp, gentable_stat}', '{}')
|
||||||
)
|
)
|
||||||
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
||||||
@ -484,7 +484,7 @@ SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
|||||||
text search parser | addr_nsp | addr_ts_prs | addr_nsp.addr_ts_prs | t
|
text search parser | addr_nsp | addr_ts_prs | addr_nsp.addr_ts_prs | t
|
||||||
text search configuration | addr_nsp | addr_ts_conf | addr_nsp.addr_ts_conf | t
|
text search configuration | addr_nsp | addr_ts_conf | addr_nsp.addr_ts_conf | t
|
||||||
text search template | addr_nsp | addr_ts_temp | addr_nsp.addr_ts_temp | t
|
text search template | addr_nsp | addr_ts_temp | addr_nsp.addr_ts_temp | t
|
||||||
subscription | | addr_sub | addr_sub | t
|
subscription | | regress_addr_sub | regress_addr_sub | t
|
||||||
publication | | addr_pub | addr_pub | t
|
publication | | addr_pub | addr_pub | t
|
||||||
publication relation | | | addr_nsp.gentable in publication addr_pub | t
|
publication relation | | | addr_nsp.gentable in publication addr_pub | t
|
||||||
(49 rows)
|
(49 rows)
|
||||||
@ -499,7 +499,7 @@ drop cascades to foreign table genftable
|
|||||||
drop cascades to server integer
|
drop cascades to server integer
|
||||||
drop cascades to user mapping for regress_addr_user on server integer
|
drop cascades to user mapping for regress_addr_user on server integer
|
||||||
DROP PUBLICATION addr_pub;
|
DROP PUBLICATION addr_pub;
|
||||||
DROP SUBSCRIPTION addr_sub;
|
DROP SUBSCRIPTION regress_addr_sub;
|
||||||
DROP SCHEMA addr_nsp CASCADE;
|
DROP SCHEMA addr_nsp CASCADE;
|
||||||
NOTICE: drop cascades to 14 other objects
|
NOTICE: drop cascades to 14 other objects
|
||||||
DETAIL: drop cascades to text search dictionary addr_ts_dict
|
DETAIL: drop cascades to text search dictionary addr_ts_dict
|
||||||
|
@ -37,11 +37,19 @@ SELECT r.rolname, s.srvname, m.umoptions
|
|||||||
JOIN pg_foreign_server s ON (s.oid = m.umserver)
|
JOIN pg_foreign_server s ON (s.oid = m.umserver)
|
||||||
ORDER BY 2;
|
ORDER BY 2;
|
||||||
$$ LANGUAGE SQL;
|
$$ LANGUAGE SQL;
|
||||||
|
--
|
||||||
|
-- We test creation and use of these role names to ensure that the server
|
||||||
|
-- correctly distinguishes role keywords from quoted names that look like
|
||||||
|
-- those keywords. In a test environment, creation of these roles may
|
||||||
|
-- provoke warnings, so hide the warnings by raising client_min_messages.
|
||||||
|
--
|
||||||
|
SET client_min_messages = ERROR;
|
||||||
CREATE ROLE "Public";
|
CREATE ROLE "Public";
|
||||||
CREATE ROLE "None";
|
CREATE ROLE "None";
|
||||||
CREATE ROLE "current_user";
|
CREATE ROLE "current_user";
|
||||||
CREATE ROLE "session_user";
|
CREATE ROLE "session_user";
|
||||||
CREATE ROLE "user";
|
CREATE ROLE "user";
|
||||||
|
RESET client_min_messages;
|
||||||
CREATE ROLE current_user; -- error
|
CREATE ROLE current_user; -- error
|
||||||
ERROR: CURRENT_USER cannot be used as a role name here
|
ERROR: CURRENT_USER cannot be used as a role name here
|
||||||
LINE 1: CREATE ROLE current_user;
|
LINE 1: CREATE ROLE current_user;
|
||||||
|
@ -6,31 +6,31 @@ CREATE ROLE regress_subscription_user2;
|
|||||||
CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
|
CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
|
||||||
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
||||||
-- fail - no publications
|
-- fail - no publications
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'foo';
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'foo';
|
||||||
ERROR: syntax error at or near ";"
|
ERROR: syntax error at or near ";"
|
||||||
LINE 1: CREATE SUBSCRIPTION testsub CONNECTION 'foo';
|
LINE 1: CREATE SUBSCRIPTION regress_testsub CONNECTION 'foo';
|
||||||
^
|
^
|
||||||
-- fail - no connection
|
-- fail - no connection
|
||||||
CREATE SUBSCRIPTION testsub PUBLICATION foo;
|
CREATE SUBSCRIPTION regress_testsub PUBLICATION foo;
|
||||||
ERROR: syntax error at or near "PUBLICATION"
|
ERROR: syntax error at or near "PUBLICATION"
|
||||||
LINE 1: CREATE SUBSCRIPTION testsub PUBLICATION foo;
|
LINE 1: CREATE SUBSCRIPTION regress_testsub PUBLICATION foo;
|
||||||
^
|
^
|
||||||
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
|
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
|
||||||
BEGIN;
|
BEGIN;
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
|
||||||
ERROR: CREATE SUBSCRIPTION ... WITH (create_slot = true) cannot run inside a transaction block
|
ERROR: CREATE SUBSCRIPTION ... WITH (create_slot = true) cannot run inside a transaction block
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- fail - invalid connection string
|
-- fail - invalid connection string
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub;
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub;
|
||||||
ERROR: invalid connection string syntax: missing "=" after "testconn" in connection info string
|
ERROR: invalid connection string syntax: missing "=" after "testconn" in connection info string
|
||||||
|
|
||||||
-- fail - duplicate publications
|
-- fail - duplicate publications
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
|
||||||
ERROR: publication name "foo" used more than once
|
ERROR: publication name "foo" used more than once
|
||||||
-- ok
|
-- ok
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
||||||
COMMENT ON SUBSCRIPTION testsub IS 'test subscription';
|
COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
|
||||||
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
||||||
obj_description
|
obj_description
|
||||||
-------------------
|
-------------------
|
||||||
@ -38,123 +38,123 @@ SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- fail - name already exists
|
-- fail - name already exists
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
||||||
ERROR: subscription "testsub" already exists
|
ERROR: subscription "regress_testsub" already exists
|
||||||
-- fail - must be superuser
|
-- fail - must be superuser
|
||||||
SET SESSION AUTHORIZATION 'regress_subscription_user2';
|
SET SESSION AUTHORIZATION 'regress_subscription_user2';
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo WITH (connect = false);
|
||||||
ERROR: must be superuser to create subscriptions
|
ERROR: must be superuser to create subscriptions
|
||||||
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
||||||
-- fail - invalid option combinations
|
-- fail - invalid option combinations
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true);
|
||||||
ERROR: connect = false and copy_data = true are mutually exclusive options
|
ERROR: connect = false and copy_data = true are mutually exclusive options
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, enabled = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, enabled = true);
|
||||||
ERROR: connect = false and enabled = true are mutually exclusive options
|
ERROR: connect = false and enabled = true are mutually exclusive options
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, create_slot = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, create_slot = true);
|
||||||
ERROR: connect = false and create_slot = true are mutually exclusive options
|
ERROR: connect = false and create_slot = true are mutually exclusive options
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = true);
|
||||||
ERROR: slot_name = NONE and enabled = true are mutually exclusive options
|
ERROR: slot_name = NONE and enabled = true are mutually exclusive options
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = true);
|
||||||
ERROR: slot_name = NONE and create_slot = true are mutually exclusive options
|
ERROR: slot_name = NONE and create_slot = true are mutually exclusive options
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE);
|
||||||
ERROR: subscription with slot_name = NONE must also set enabled = false
|
ERROR: subscription with slot_name = NONE must also set enabled = false
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = false);
|
||||||
ERROR: subscription with slot_name = NONE must also set create_slot = false
|
ERROR: subscription with slot_name = NONE must also set create_slot = false
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = false);
|
||||||
ERROR: subscription with slot_name = NONE must also set enabled = false
|
ERROR: subscription with slot_name = NONE must also set enabled = false
|
||||||
-- ok - with slot_name = NONE
|
-- ok - with slot_name = NONE
|
||||||
CREATE SUBSCRIPTION testsub3 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
||||||
-- fail
|
-- fail
|
||||||
ALTER SUBSCRIPTION testsub3 ENABLE;
|
ALTER SUBSCRIPTION regress_testsub3 ENABLE;
|
||||||
ERROR: cannot enable subscription that does not have a slot name
|
ERROR: cannot enable subscription that does not have a slot name
|
||||||
ALTER SUBSCRIPTION testsub3 REFRESH PUBLICATION;
|
ALTER SUBSCRIPTION regress_testsub3 REFRESH PUBLICATION;
|
||||||
ERROR: ALTER SUBSCRIPTION ... REFRESH is not allowed for disabled subscriptions
|
ERROR: ALTER SUBSCRIPTION ... REFRESH is not allowed for disabled subscriptions
|
||||||
DROP SUBSCRIPTION testsub3;
|
DROP SUBSCRIPTION regress_testsub3;
|
||||||
-- fail - invalid connection string
|
-- fail - invalid connection string
|
||||||
ALTER SUBSCRIPTION testsub CONNECTION 'foobar';
|
ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
|
||||||
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string
|
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
||||||
---------+---------------------------+---------+-------------+--------------------+---------------------
|
-----------------+---------------------------+---------+-------------+--------------------+-----------------------------
|
||||||
testsub | regress_subscription_user | f | {testpub} | off | dbname=doesnotexist
|
regress_testsub | regress_subscription_user | f | {testpub} | off | dbname=regress_doesnotexist
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
||||||
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
|
ALTER SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist2';
|
||||||
ALTER SUBSCRIPTION testsub SET (slot_name = 'newname');
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = 'newname');
|
||||||
-- fail
|
-- fail
|
||||||
ALTER SUBSCRIPTION doesnotexist CONNECTION 'dbname=doesnotexist2';
|
ALTER SUBSCRIPTION regress_doesnotexist CONNECTION 'dbname=regress_doesnotexist2';
|
||||||
ERROR: subscription "doesnotexist" does not exist
|
ERROR: subscription "regress_doesnotexist" does not exist
|
||||||
ALTER SUBSCRIPTION testsub SET (create_slot = false);
|
ALTER SUBSCRIPTION regress_testsub SET (create_slot = false);
|
||||||
ERROR: unrecognized subscription parameter: "create_slot"
|
ERROR: unrecognized subscription parameter: "create_slot"
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
||||||
---------+---------------------------+---------+---------------------+--------------------+----------------------
|
-----------------+---------------------------+---------+---------------------+--------------------+------------------------------
|
||||||
testsub | regress_subscription_user | f | {testpub2,testpub3} | off | dbname=doesnotexist2
|
regress_testsub | regress_subscription_user | f | {testpub2,testpub3} | off | dbname=regress_doesnotexist2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
ALTER SUBSCRIPTION testsub ENABLE;
|
ALTER SUBSCRIPTION regress_testsub ENABLE;
|
||||||
\dRs
|
\dRs
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication
|
Name | Owner | Enabled | Publication
|
||||||
---------+---------------------------+---------+---------------------
|
-----------------+---------------------------+---------+---------------------
|
||||||
testsub | regress_subscription_user | t | {testpub2,testpub3}
|
regress_testsub | regress_subscription_user | t | {testpub2,testpub3}
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub DISABLE;
|
ALTER SUBSCRIPTION regress_testsub DISABLE;
|
||||||
\dRs
|
\dRs
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication
|
Name | Owner | Enabled | Publication
|
||||||
---------+---------------------------+---------+---------------------
|
-----------------+---------------------------+---------+---------------------
|
||||||
testsub | regress_subscription_user | f | {testpub2,testpub3}
|
regress_testsub | regress_subscription_user | f | {testpub2,testpub3}
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
-- fail - must be owner of subscription
|
-- fail - must be owner of subscription
|
||||||
SET ROLE regress_subscription_user_dummy;
|
SET ROLE regress_subscription_user_dummy;
|
||||||
ALTER SUBSCRIPTION testsub RENAME TO testsub_dummy;
|
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_dummy;
|
||||||
ERROR: must be owner of subscription testsub
|
ERROR: must be owner of subscription regress_testsub
|
||||||
RESET ROLE;
|
RESET ROLE;
|
||||||
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
|
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
|
||||||
ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = local);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
|
||||||
ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = foobar);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
||||||
ERROR: invalid value for parameter "synchronous_commit": "foobar"
|
ERROR: invalid value for parameter "synchronous_commit": "foobar"
|
||||||
HINT: Available values: local, remote_write, remote_apply, on, off.
|
HINT: Available values: local, remote_write, remote_apply, on, off.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
|
||||||
-------------+---------------------------+---------+---------------------+--------------------+----------------------
|
---------------------+---------------------------+---------+---------------------+--------------------+------------------------------
|
||||||
testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | local | dbname=doesnotexist2
|
regress_testsub_foo | regress_subscription_user | f | {testpub2,testpub3} | local | dbname=regress_doesnotexist2
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- rename back to keep the rest simple
|
-- rename back to keep the rest simple
|
||||||
ALTER SUBSCRIPTION testsub_foo RENAME TO testsub;
|
ALTER SUBSCRIPTION regress_testsub_foo RENAME TO regress_testsub;
|
||||||
-- fail - new owner must be superuser
|
-- fail - new owner must be superuser
|
||||||
ALTER SUBSCRIPTION testsub OWNER TO regress_subscription_user2;
|
ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
|
||||||
ERROR: permission denied to change owner of subscription "testsub"
|
ERROR: permission denied to change owner of subscription "regress_testsub"
|
||||||
HINT: The owner of a subscription must be a superuser.
|
HINT: The owner of a subscription must be a superuser.
|
||||||
ALTER ROLE regress_subscription_user2 SUPERUSER;
|
ALTER ROLE regress_subscription_user2 SUPERUSER;
|
||||||
-- now it works
|
-- now it works
|
||||||
ALTER SUBSCRIPTION testsub OWNER TO regress_subscription_user2;
|
ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
|
||||||
-- fail - cannot do DROP SUBSCRIPTION inside transaction block with slot name
|
-- fail - cannot do DROP SUBSCRIPTION inside transaction block with slot name
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP SUBSCRIPTION testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
ERROR: DROP SUBSCRIPTION cannot run inside a transaction block
|
ERROR: DROP SUBSCRIPTION cannot run inside a transaction block
|
||||||
COMMIT;
|
COMMIT;
|
||||||
ALTER SUBSCRIPTION testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
-- now it works
|
-- now it works
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP SUBSCRIPTION testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
DROP SUBSCRIPTION IF EXISTS testsub;
|
DROP SUBSCRIPTION IF EXISTS regress_testsub;
|
||||||
NOTICE: subscription "testsub" does not exist, skipping
|
NOTICE: subscription "regress_testsub" does not exist, skipping
|
||||||
DROP SUBSCRIPTION testsub; -- fail
|
DROP SUBSCRIPTION regress_testsub; -- fail
|
||||||
ERROR: subscription "testsub" does not exist
|
ERROR: subscription "regress_testsub" does not exist
|
||||||
RESET SESSION AUTHORIZATION;
|
RESET SESSION AUTHORIZATION;
|
||||||
DROP ROLE regress_subscription_user;
|
DROP ROLE regress_subscription_user;
|
||||||
DROP ROLE regress_subscription_user2;
|
DROP ROLE regress_subscription_user2;
|
||||||
|
@ -46,7 +46,7 @@ CREATE TRANSFORM FOR int LANGUAGE SQL (
|
|||||||
FROM SQL WITH FUNCTION prsd_lextype(internal),
|
FROM SQL WITH FUNCTION prsd_lextype(internal),
|
||||||
TO SQL WITH FUNCTION int4recv(internal));
|
TO SQL WITH FUNCTION int4recv(internal));
|
||||||
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
|
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
|
||||||
CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
||||||
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
||||||
|
|
||||||
-- test some error cases
|
-- test some error cases
|
||||||
@ -195,7 +195,7 @@ WITH objects (type, name, args) AS (VALUES
|
|||||||
('access method', '{btree}', '{}'),
|
('access method', '{btree}', '{}'),
|
||||||
('publication', '{addr_pub}', '{}'),
|
('publication', '{addr_pub}', '{}'),
|
||||||
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
|
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
|
||||||
('subscription', '{addr_sub}', '{}'),
|
('subscription', '{regress_addr_sub}', '{}'),
|
||||||
('statistics object', '{addr_nsp, gentable_stat}', '{}')
|
('statistics object', '{addr_nsp, gentable_stat}', '{}')
|
||||||
)
|
)
|
||||||
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
||||||
@ -212,7 +212,7 @@ SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
|
|||||||
---
|
---
|
||||||
DROP FOREIGN DATA WRAPPER addr_fdw CASCADE;
|
DROP FOREIGN DATA WRAPPER addr_fdw CASCADE;
|
||||||
DROP PUBLICATION addr_pub;
|
DROP PUBLICATION addr_pub;
|
||||||
DROP SUBSCRIPTION addr_sub;
|
DROP SUBSCRIPTION regress_addr_sub;
|
||||||
|
|
||||||
DROP SCHEMA addr_nsp CASCADE;
|
DROP SCHEMA addr_nsp CASCADE;
|
||||||
|
|
||||||
|
@ -40,12 +40,22 @@ SELECT r.rolname, s.srvname, m.umoptions
|
|||||||
ORDER BY 2;
|
ORDER BY 2;
|
||||||
$$ LANGUAGE SQL;
|
$$ LANGUAGE SQL;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- We test creation and use of these role names to ensure that the server
|
||||||
|
-- correctly distinguishes role keywords from quoted names that look like
|
||||||
|
-- those keywords. In a test environment, creation of these roles may
|
||||||
|
-- provoke warnings, so hide the warnings by raising client_min_messages.
|
||||||
|
--
|
||||||
|
SET client_min_messages = ERROR;
|
||||||
|
|
||||||
CREATE ROLE "Public";
|
CREATE ROLE "Public";
|
||||||
CREATE ROLE "None";
|
CREATE ROLE "None";
|
||||||
CREATE ROLE "current_user";
|
CREATE ROLE "current_user";
|
||||||
CREATE ROLE "session_user";
|
CREATE ROLE "session_user";
|
||||||
CREATE ROLE "user";
|
CREATE ROLE "user";
|
||||||
|
|
||||||
|
RESET client_min_messages;
|
||||||
|
|
||||||
CREATE ROLE current_user; -- error
|
CREATE ROLE current_user; -- error
|
||||||
CREATE ROLE current_role; -- error
|
CREATE ROLE current_role; -- error
|
||||||
CREATE ROLE session_user; -- error
|
CREATE ROLE session_user; -- error
|
||||||
|
@ -8,75 +8,75 @@ CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
|
|||||||
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
||||||
|
|
||||||
-- fail - no publications
|
-- fail - no publications
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'foo';
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'foo';
|
||||||
|
|
||||||
-- fail - no connection
|
-- fail - no connection
|
||||||
CREATE SUBSCRIPTION testsub PUBLICATION foo;
|
CREATE SUBSCRIPTION regress_testsub PUBLICATION foo;
|
||||||
|
|
||||||
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
|
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
|
||||||
BEGIN;
|
BEGIN;
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
-- fail - invalid connection string
|
-- fail - invalid connection string
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub;
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub;
|
||||||
|
|
||||||
-- fail - duplicate publications
|
-- fail - duplicate publications
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
|
||||||
|
|
||||||
-- ok
|
-- ok
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
||||||
|
|
||||||
COMMENT ON SUBSCRIPTION testsub IS 'test subscription';
|
COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
|
||||||
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
||||||
|
|
||||||
-- fail - name already exists
|
-- fail - name already exists
|
||||||
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
||||||
|
|
||||||
-- fail - must be superuser
|
-- fail - must be superuser
|
||||||
SET SESSION AUTHORIZATION 'regress_subscription_user2';
|
SET SESSION AUTHORIZATION 'regress_subscription_user2';
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo WITH (connect = false);
|
||||||
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
||||||
|
|
||||||
-- fail - invalid option combinations
|
-- fail - invalid option combinations
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, enabled = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, enabled = true);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false, create_slot = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, create_slot = true);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = true);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = true);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = true);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = false);
|
||||||
CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = false);
|
CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = false);
|
||||||
|
|
||||||
-- ok - with slot_name = NONE
|
-- ok - with slot_name = NONE
|
||||||
CREATE SUBSCRIPTION testsub3 CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
||||||
-- fail
|
-- fail
|
||||||
ALTER SUBSCRIPTION testsub3 ENABLE;
|
ALTER SUBSCRIPTION regress_testsub3 ENABLE;
|
||||||
ALTER SUBSCRIPTION testsub3 REFRESH PUBLICATION;
|
ALTER SUBSCRIPTION regress_testsub3 REFRESH PUBLICATION;
|
||||||
|
|
||||||
DROP SUBSCRIPTION testsub3;
|
DROP SUBSCRIPTION regress_testsub3;
|
||||||
|
|
||||||
-- fail - invalid connection string
|
-- fail - invalid connection string
|
||||||
ALTER SUBSCRIPTION testsub CONNECTION 'foobar';
|
ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false);
|
||||||
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
|
ALTER SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist2';
|
||||||
ALTER SUBSCRIPTION testsub SET (slot_name = 'newname');
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = 'newname');
|
||||||
|
|
||||||
-- fail
|
-- fail
|
||||||
ALTER SUBSCRIPTION doesnotexist CONNECTION 'dbname=doesnotexist2';
|
ALTER SUBSCRIPTION regress_doesnotexist CONNECTION 'dbname=regress_doesnotexist2';
|
||||||
ALTER SUBSCRIPTION testsub SET (create_slot = false);
|
ALTER SUBSCRIPTION regress_testsub SET (create_slot = false);
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
ALTER SUBSCRIPTION testsub ENABLE;
|
ALTER SUBSCRIPTION regress_testsub ENABLE;
|
||||||
|
|
||||||
\dRs
|
\dRs
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub DISABLE;
|
ALTER SUBSCRIPTION regress_testsub DISABLE;
|
||||||
|
|
||||||
\dRs
|
\dRs
|
||||||
|
|
||||||
@ -84,38 +84,38 @@ COMMIT;
|
|||||||
|
|
||||||
-- fail - must be owner of subscription
|
-- fail - must be owner of subscription
|
||||||
SET ROLE regress_subscription_user_dummy;
|
SET ROLE regress_subscription_user_dummy;
|
||||||
ALTER SUBSCRIPTION testsub RENAME TO testsub_dummy;
|
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_dummy;
|
||||||
RESET ROLE;
|
RESET ROLE;
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
|
ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
|
||||||
ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = local);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
|
||||||
ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = foobar);
|
ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
|
||||||
|
|
||||||
\dRs+
|
\dRs+
|
||||||
|
|
||||||
-- rename back to keep the rest simple
|
-- rename back to keep the rest simple
|
||||||
ALTER SUBSCRIPTION testsub_foo RENAME TO testsub;
|
ALTER SUBSCRIPTION regress_testsub_foo RENAME TO regress_testsub;
|
||||||
|
|
||||||
-- fail - new owner must be superuser
|
-- fail - new owner must be superuser
|
||||||
ALTER SUBSCRIPTION testsub OWNER TO regress_subscription_user2;
|
ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
|
||||||
ALTER ROLE regress_subscription_user2 SUPERUSER;
|
ALTER ROLE regress_subscription_user2 SUPERUSER;
|
||||||
-- now it works
|
-- now it works
|
||||||
ALTER SUBSCRIPTION testsub OWNER TO regress_subscription_user2;
|
ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2;
|
||||||
|
|
||||||
-- fail - cannot do DROP SUBSCRIPTION inside transaction block with slot name
|
-- fail - cannot do DROP SUBSCRIPTION inside transaction block with slot name
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP SUBSCRIPTION testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
ALTER SUBSCRIPTION testsub SET (slot_name = NONE);
|
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
|
||||||
|
|
||||||
-- now it works
|
-- now it works
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP SUBSCRIPTION testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
DROP SUBSCRIPTION IF EXISTS testsub;
|
DROP SUBSCRIPTION IF EXISTS regress_testsub;
|
||||||
DROP SUBSCRIPTION testsub; -- fail
|
DROP SUBSCRIPTION regress_testsub; -- fail
|
||||||
|
|
||||||
RESET SESSION AUTHORIZATION;
|
RESET SESSION AUTHORIZATION;
|
||||||
DROP ROLE regress_subscription_user;
|
DROP ROLE regress_subscription_user;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user