Commit 6af8b89a authored by Stephen Frost's avatar Stephen Frost

perltidy pg_dump TAP tests

The pg_dump TAP tests have gotten pretty far from what perltidy thinks
they should be, so fix that, and in passing use long-form argument names
with arguments passed via "=" in a similar vein to 58da8334.

No functional changes here, just whitespace and changing runs from
"-f" to "--file=", and similar.
parent 58da8334
...@@ -49,11 +49,9 @@ command_exit_is( ...@@ -49,11 +49,9 @@ command_exit_is(
'pg_restore: options -s/--schema-only and -a/--data-only cannot be used together' 'pg_restore: options -s/--schema-only and -a/--data-only cannot be used together'
); );
command_exit_is( command_exit_is([ 'pg_restore', '-d', 'xxx', '-f', 'xxx' ],
[ 'pg_restore', '-d', 'xxx', '-f', 'xxx' ],
1, 1,
'pg_restore: options -d/--dbname and -f/--file cannot be used together' 'pg_restore: options -d/--dbname and -f/--file cannot be used together');
);
command_exit_is( command_exit_is(
[ 'pg_dump', '-c', '-a' ], [ 'pg_dump', '-c', '-a' ],
...@@ -63,7 +61,7 @@ command_exit_is( ...@@ -63,7 +61,7 @@ command_exit_is(
command_exit_is( command_exit_is(
[ 'pg_restore', '-c', '-a' ], [ 'pg_restore', '-c', '-a' ],
1, 1,
'pg_restore: options -c/--clean and -a/--data-only cannot be used together'); 'pg_restore: options -c/--clean and -a/--data-only cannot be used together');
command_exit_is( command_exit_is(
[ 'pg_dump', '--inserts', '-o' ], [ 'pg_dump', '--inserts', '-o' ],
...@@ -80,8 +78,10 @@ command_exit_is([ 'pg_dump', '-j' ], ...@@ -80,8 +78,10 @@ command_exit_is([ 'pg_dump', '-j' ],
command_exit_is([ 'pg_dump', '-j3' ], command_exit_is([ 'pg_dump', '-j3' ],
1, 'pg_dump: parallel backup only supported by the directory format'); 1, 'pg_dump: parallel backup only supported by the directory format');
command_exit_is([ 'pg_restore', '--single-transaction', '-j3' ], command_exit_is(
1, 'pg_restore: cannot specify both --single-transaction and multiple jobs'); [ 'pg_restore', '--single-transaction', '-j3' ],
1,
'pg_restore: cannot specify both --single-transaction and multiple jobs');
command_exit_is([ 'pg_restore', '--if-exists' ], command_exit_is([ 'pg_restore', '--if-exists' ],
1, 'pg_restore: option --if-exists requires option -c/--clean'); 1, 'pg_restore: option --if-exists requires option -c/--clean');
......
...@@ -39,7 +39,7 @@ my %pgdump_runs = ( ...@@ -39,7 +39,7 @@ my %pgdump_runs = (
binary_upgrade => { binary_upgrade => {
dump_cmd => [ dump_cmd => [
'pg_dump', 'pg_dump',
'-f', "$tempdir/binary_upgrade.sql", "--file=$tempdir/binary_upgrade.sql",
'--schema-only', '--schema-only',
'--binary-upgrade', '--binary-upgrade',
'-d', 'postgres', # alternative way to specify database '-d', 'postgres', # alternative way to specify database
...@@ -47,36 +47,36 @@ my %pgdump_runs = ( ...@@ -47,36 +47,36 @@ my %pgdump_runs = (
clean => { clean => {
dump_cmd => [ dump_cmd => [
'pg_dump', 'pg_dump',
'-f', "$tempdir/clean.sql", "--file=$tempdir/clean.sql",
'-c', '-c',
'-d', 'postgres', # alternative way to specify database '-d', 'postgres', # alternative way to specify database
], }, ], },
clean_if_exists => { clean_if_exists => {
dump_cmd => [ dump_cmd => [
'pg_dump', 'pg_dump',
'-f', "$tempdir/clean_if_exists.sql", "--file=$tempdir/clean_if_exists.sql",
'-c', '-c',
'--if-exists', '--if-exists',
'-E', 'UTF8', # no-op, just tests that option is accepted '--encoding=UTF8', # no-op, just tests that option is accepted
'postgres', ], }, 'postgres', ], },
column_inserts => { column_inserts => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', 'pg_dump', "--file=$tempdir/column_inserts.sql",
"$tempdir/column_inserts.sql", '-a', '-a', '--column-inserts',
'--column-inserts', 'postgres', ], }, 'postgres', ], },
createdb => { createdb => {
dump_cmd => [ dump_cmd => [
'pg_dump', 'pg_dump',
'-f', "$tempdir/createdb.sql", "--file=$tempdir/createdb.sql",
'-C', '-C',
'-R', # no-op, just for testing '-R', # no-op, just for testing
'postgres', ], }, 'postgres', ], },
data_only => { data_only => {
dump_cmd => [ dump_cmd => [
'pg_dump', 'pg_dump',
'-f', "$tempdir/data_only.sql", "--file=$tempdir/data_only.sql",
'-a', '-a',
'-v', # no-op, just make sure it works '-v', # no-op, just make sure it works
'postgres', ], }, 'postgres', ], },
defaults => { defaults => {
dump_cmd => [ 'pg_dump', '-f', "$tempdir/defaults.sql", 'postgres', ], dump_cmd => [ 'pg_dump', '-f', "$tempdir/defaults.sql", 'postgres', ],
...@@ -84,110 +84,113 @@ my %pgdump_runs = ( ...@@ -84,110 +84,113 @@ my %pgdump_runs = (
defaults_custom_format => { defaults_custom_format => {
test_key => 'defaults', test_key => 'defaults',
dump_cmd => [ dump_cmd => [
'pg_dump', '-Fc', '-Z6', '-f', 'pg_dump', '-Fc', '-Z6',
"$tempdir/defaults_custom_format.dump", 'postgres', ], "--file=$tempdir/defaults_custom_format.dump", 'postgres', ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore', '-Fc',
'-Fc', '-f', "--file=$tempdir/defaults_custom_format.sql",
"$tempdir/defaults_custom_format.sql",
"$tempdir/defaults_custom_format.dump", ], }, "$tempdir/defaults_custom_format.dump", ], },
defaults_dir_format => { defaults_dir_format => {
test_key => 'defaults', test_key => 'defaults',
dump_cmd => [ dump_cmd => [
'pg_dump', '-Fd', '-f', "$tempdir/defaults_dir_format", 'pg_dump', '-Fd',
'postgres', ], "--file=$tempdir/defaults_dir_format", 'postgres', ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore', '-Fd',
'-Fd', '-f', "--file=$tempdir/defaults_dir_format.sql",
"$tempdir/defaults_dir_format.sql",
"$tempdir/defaults_dir_format", ], }, "$tempdir/defaults_dir_format", ], },
defaults_parallel => { defaults_parallel => {
test_key => 'defaults', test_key => 'defaults',
dump_cmd => [ dump_cmd => [
'pg_dump', '-Fd', '-j2', '-f', "$tempdir/defaults_parallel", 'pg_dump', '-Fd', '-j2', "--file=$tempdir/defaults_parallel",
'postgres', ], 'postgres', ],
restore_cmd => [ restore_cmd => [
'pg_restore', '-f', 'pg_restore',
"$tempdir/defaults_parallel.sql", "$tempdir/defaults_parallel", ], "--file=$tempdir/defaults_parallel.sql",
}, "$tempdir/defaults_parallel", ], },
defaults_tar_format => { defaults_tar_format => {
test_key => 'defaults', test_key => 'defaults',
dump_cmd => [ dump_cmd => [
'pg_dump', '-Ft', '-f', "$tempdir/defaults_tar_format.tar", 'pg_dump', '-Ft',
'postgres', ], "--file=$tempdir/defaults_tar_format.tar", 'postgres', ],
restore_cmd => [ restore_cmd => [
'pg_restore', 'pg_restore', '-Ft',
'-Ft', '-f', "--file=$tempdir/defaults_tar_format.sql",
"$tempdir/defaults_tar_format.sql",
"$tempdir/defaults_tar_format.tar", ], }, "$tempdir/defaults_tar_format.tar", ], },
exclude_dump_test_schema => { exclude_dump_test_schema => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/exclude_dump_test_schema.sql", 'pg_dump', "--file=$tempdir/exclude_dump_test_schema.sql",
'-N', 'dump_test', 'postgres', ], }, '--exclude-schema=dump_test', 'postgres', ], },
exclude_test_table => { exclude_test_table => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', 'pg_dump',
"$tempdir/exclude_test_table.sql", '-T', "--file=$tempdir/exclude_test_table.sql",
'dump_test.test_table', 'postgres', ], }, '--exclude-table=dump_test.test_table',
'postgres', ], },
exclude_test_table_data => { exclude_test_table_data => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', 'pg_dump',
"$tempdir/exclude_test_table_data.sql", "--file=$tempdir/exclude_test_table_data.sql",
'--exclude-table-data=dump_test.test_table', 'postgres', ], }, '--exclude-table-data=dump_test.test_table',
'postgres', ], },
pg_dumpall_globals => { pg_dumpall_globals => {
dump_cmd => dump_cmd => [
[ 'pg_dumpall', '-v', '-f', "$tempdir/pg_dumpall_globals.sql", '-g', ], }, 'pg_dumpall', '-v',
"--file=$tempdir/pg_dumpall_globals.sql", '-g', ], },
pg_dumpall_globals_clean => { pg_dumpall_globals_clean => {
dump_cmd => [ dump_cmd => [
'pg_dumpall', '-f', "$tempdir/pg_dumpall_globals_clean.sql", 'pg_dumpall', "--file=$tempdir/pg_dumpall_globals_clean.sql",
'-g', '-c', ], }, '-g', '-c', ], },
pg_dumpall_dbprivs => { pg_dumpall_dbprivs => {
dump_cmd => dump_cmd =>
[ 'pg_dumpall', '-f', "$tempdir/pg_dumpall_dbprivs.sql", ], }, [ 'pg_dumpall', "--file=$tempdir/pg_dumpall_dbprivs.sql", ], },
no_blobs => { no_blobs => {
dump_cmd => dump_cmd =>
[ 'pg_dump', '-f', "$tempdir/no_blobs.sql", '-B', 'postgres', ], }, [ 'pg_dump', "--file=$tempdir/no_blobs.sql", '-B', 'postgres', ], },
no_privs => { no_privs => {
dump_cmd => dump_cmd =>
[ 'pg_dump', '-f', "$tempdir/no_privs.sql", '-x', 'postgres', ], }, [ 'pg_dump', "--file=$tempdir/no_privs.sql", '-x', 'postgres', ], },
no_owner => { no_owner => {
dump_cmd => dump_cmd =>
[ 'pg_dump', '-f', "$tempdir/no_owner.sql", '-O', 'postgres', ], }, [ 'pg_dump', "--file=$tempdir/no_owner.sql", '-O', 'postgres', ], },
only_dump_test_schema => { only_dump_test_schema => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/only_dump_test_schema.sql", 'pg_dump', "--file=$tempdir/only_dump_test_schema.sql",
'-n', 'dump_test', 'postgres', ], }, '--schema=dump_test', 'postgres', ], },
only_dump_test_table => { only_dump_test_table => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/only_dump_test_table.sql", 'pg_dump',
'-t', 'dump_test.test_table', '--lock-wait-timeout=1000000', "--file=$tempdir/only_dump_test_table.sql",
'--table=dump_test.test_table',
'--lock-wait-timeout=1000000',
'postgres', ], }, 'postgres', ], },
role => { role => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/role.sql", 'pg_dump',
"--file=$tempdir/role.sql",
'--role=regress_dump_test_role', '--role=regress_dump_test_role',
'--schema=dump_test_second_schema', 'postgres', ], }, '--schema=dump_test_second_schema',
'postgres', ], },
schema_only => { schema_only => {
dump_cmd => dump_cmd =>
[ 'pg_dump', '-f', "$tempdir/schema_only.sql", '-s', 'postgres', ], [ 'pg_dump', "--file=$tempdir/schema_only.sql", '-s', 'postgres', ],
}, },
section_pre_data => { section_pre_data => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/section_pre_data.sql", 'pg_dump', "--file=$tempdir/section_pre_data.sql",
'--section=pre-data', 'postgres', ], }, '--section=pre-data', 'postgres', ], },
section_data => { section_data => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', 'pg_dump', "--file=$tempdir/section_data.sql",
"$tempdir/section_data.sql", '--section=data', '--section=data', 'postgres', ], },
'postgres', ], },
section_post_data => { section_post_data => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/section_post_data.sql", 'pg_dump', "--file=$tempdir/section_post_data.sql",
'--section=post-data', 'postgres', ], }, '--section=post-data', 'postgres', ], },
test_schema_plus_blobs => { test_schema_plus_blobs => {
dump_cmd => [ dump_cmd => [
'pg_dump', '-f', "$tempdir/test_schema_plus_blobs.sql", 'pg_dump', "--file=$tempdir/test_schema_plus_blobs.sql",
'-n', 'dump_test', '-b', '-B', 'postgres', ], },); '--schema=dump_test', '-b', '-B', 'postgres', ], },);
############################################################### ###############################################################
# Definition of the tests to run. # Definition of the tests to run.
...@@ -228,7 +231,7 @@ my %pgdump_runs = ( ...@@ -228,7 +231,7 @@ my %pgdump_runs = (
my %tests = ( my %tests = (
'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role' => { 'ALTER DEFAULT PRIVILEGES FOR ROLE regress_dump_test_role' => {
all_runs => 1, all_runs => 1,
create_order => 14, create_order => 14,
create_sql => 'ALTER DEFAULT PRIVILEGES create_sql => 'ALTER DEFAULT PRIVILEGES
FOR ROLE regress_dump_test_role IN SCHEMA dump_test FOR ROLE regress_dump_test_role IN SCHEMA dump_test
...@@ -267,7 +270,7 @@ my %tests = ( ...@@ -267,7 +270,7 @@ my %tests = (
'ALTER ROLE regress_dump_test_role' => { 'ALTER ROLE regress_dump_test_role' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QALTER ROLE regress_dump_test_role WITH \E \QALTER ROLE regress_dump_test_role WITH \E
\QNOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB NOLOGIN \E \QNOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB NOLOGIN \E
\QNOREPLICATION NOBYPASSRLS;\E \QNOREPLICATION NOBYPASSRLS;\E
...@@ -301,7 +304,8 @@ my %tests = ( ...@@ -301,7 +304,8 @@ my %tests = (
'ALTER FUNCTION dump_test.pltestlang_call_handler() OWNER TO' => { 'ALTER FUNCTION dump_test.pltestlang_call_handler() OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ regexp => qr/^
\QALTER FUNCTION dump_test.pltestlang_call_handler() \E \QALTER FUNCTION dump_test.pltestlang_call_handler() \E
\QOWNER TO \E \QOWNER TO \E
...@@ -328,8 +332,8 @@ my %tests = ( ...@@ -328,8 +332,8 @@ my %tests = (
'ALTER LARGE OBJECT ... OWNER TO' => { 'ALTER LARGE OBJECT ... OWNER TO' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .*;/m, regexp => qr/^ALTER LARGE OBJECT \d+ OWNER TO .*;/m,
like => { like => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
column_inserts => 1, column_inserts => 1,
...@@ -358,7 +362,8 @@ my %tests = ( ...@@ -358,7 +362,8 @@ my %tests = (
'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => { 'ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .*;/m, regexp => qr/^ALTER PROCEDURAL LANGUAGE pltestlang OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -382,7 +387,8 @@ my %tests = ( ...@@ -382,7 +387,8 @@ my %tests = (
'ALTER SCHEMA dump_test OWNER TO' => { 'ALTER SCHEMA dump_test OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER SCHEMA dump_test OWNER TO .*;/m, regexp => qr/^ALTER SCHEMA dump_test OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -406,7 +412,8 @@ my %tests = ( ...@@ -406,7 +412,8 @@ my %tests = (
'ALTER SCHEMA dump_test_second_schema OWNER TO' => { 'ALTER SCHEMA dump_test_second_schema OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .*;/m, regexp => qr/^ALTER SCHEMA dump_test_second_schema OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -430,7 +437,7 @@ my %tests = ( ...@@ -430,7 +437,7 @@ my %tests = (
'ALTER SEQUENCE test_table_col1_seq' => { 'ALTER SEQUENCE test_table_col1_seq' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QALTER SEQUENCE test_table_col1_seq OWNED BY test_table.col1;\E \QALTER SEQUENCE test_table_col1_seq OWNED BY test_table.col1;\E
/xm, /xm,
like => { like => {
...@@ -451,7 +458,7 @@ my %tests = ( ...@@ -451,7 +458,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, test_schema_plus_blobs => 1, },
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
exclude_test_table => 1, exclude_test_table => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
pg_dumpall_globals => 1, pg_dumpall_globals => 1,
...@@ -462,7 +469,7 @@ my %tests = ( ...@@ -462,7 +469,7 @@ my %tests = (
'ALTER SEQUENCE test_third_table_col1_seq' => { 'ALTER SEQUENCE test_third_table_col1_seq' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QALTER SEQUENCE test_third_table_col1_seq OWNED BY test_third_table.col1;\E \QALTER SEQUENCE test_third_table_col1_seq OWNED BY test_third_table.col1;\E
/xm, /xm,
like => { like => {
...@@ -493,9 +500,9 @@ my %tests = ( ...@@ -493,9 +500,9 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'ALTER TABLE ONLY test_table ADD CONSTRAINT ... PRIMARY KEY' => { 'ALTER TABLE ONLY test_table ADD CONSTRAINT ... PRIMARY KEY' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER TABLE ... commands', catch_all => 'ALTER TABLE ... commands',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY test_table\E \n^\s+ \QALTER TABLE ONLY test_table\E \n^\s+
\QADD CONSTRAINT test_table_pkey PRIMARY KEY (col1);\E \QADD CONSTRAINT test_table_pkey PRIMARY KEY (col1);\E
/xm, /xm,
...@@ -524,7 +531,8 @@ my %tests = ( ...@@ -524,7 +531,8 @@ my %tests = (
'ALTER TABLE test_table OWNER TO' => { 'ALTER TABLE test_table OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER TABLE test_table OWNER TO .*;/m, regexp => qr/^ALTER TABLE test_table OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -547,8 +555,8 @@ my %tests = ( ...@@ -547,8 +555,8 @@ my %tests = (
role => 1, }, }, role => 1, }, },
'ALTER TABLE test_table ENABLE ROW LEVEL SECURITY' => { 'ALTER TABLE test_table ENABLE ROW LEVEL SECURITY' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER TABLE ... commands', catch_all => 'ALTER TABLE ... commands',
create_order => 23, create_order => 23,
create_sql => 'ALTER TABLE dump_test.test_table create_sql => 'ALTER TABLE dump_test.test_table
ENABLE ROW LEVEL SECURITY;', ENABLE ROW LEVEL SECURITY;',
...@@ -577,7 +585,8 @@ my %tests = ( ...@@ -577,7 +585,8 @@ my %tests = (
'ALTER TABLE test_second_table OWNER TO' => { 'ALTER TABLE test_second_table OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER TABLE test_second_table OWNER TO .*;/m, regexp => qr/^ALTER TABLE test_second_table OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -601,7 +610,8 @@ my %tests = ( ...@@ -601,7 +610,8 @@ my %tests = (
'ALTER TABLE test_third_table OWNER TO' => { 'ALTER TABLE test_third_table OWNER TO' => {
all_runs => 1, all_runs => 1,
catch_all => 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)', catch_all =>
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
regexp => qr/^ALTER TABLE test_third_table OWNER TO .*;/m, regexp => qr/^ALTER TABLE test_third_table OWNER TO .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
...@@ -625,9 +635,9 @@ my %tests = ( ...@@ -625,9 +635,9 @@ my %tests = (
# catch-all for ALTER ... OWNER (except LARGE OBJECTs and PUBLICATIONs) # catch-all for ALTER ... OWNER (except LARGE OBJECTs and PUBLICATIONs)
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)' => { 'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)' => {
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^ALTER (?!LARGE OBJECT|PUBLICATION)(.*) OWNER TO .*;/m, regexp => qr/^ALTER (?!LARGE OBJECT|PUBLICATION)(.*) OWNER TO .*;/m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
...@@ -639,9 +649,9 @@ my %tests = ( ...@@ -639,9 +649,9 @@ my %tests = (
# catch-all for ALTER TABLE ... (except OWNER TO) # catch-all for ALTER TABLE ... (except OWNER TO)
'ALTER TABLE ... commands' => { 'ALTER TABLE ... commands' => {
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^ALTER TABLE .* (?!OWNER TO)(.*);/m, regexp => qr/^ALTER TABLE .* (?!OWNER TO)(.*);/m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
...@@ -650,82 +660,77 @@ my %tests = ( ...@@ -650,82 +660,77 @@ my %tests = (
section_data => 1, }, }, section_data => 1, }, },
'BLOB create (using lo_from_bytea)' => { 'BLOB create (using lo_from_bytea)' => {
all_runs => 1, all_runs => 1,
create_order => 50, create_order => 50,
create_sql => 'SELECT pg_catalog.lo_from_bytea(0, \'\\x310a320a330a340a350a360a370a380a390a\');', create_sql =>
'SELECT pg_catalog.lo_from_bytea(0, \'\\x310a320a330a340a350a360a370a380a390a\');',
regexp => qr/^SELECT pg_catalog\.lo_create\('\d+'\);/m, regexp => qr/^SELECT pg_catalog\.lo_create\('\d+'\);/m,
like => { like => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
column_inserts => 1, column_inserts => 1,
createdb => 1, createdb => 1,
data_only => 1, data_only => 1,
defaults => 1, defaults => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, exclude_test_table => 1,
exclude_test_table_data => 1, exclude_test_table_data => 1,
no_privs => 1, no_privs => 1,
no_owner => 1, no_owner => 1,
pg_dumpall_dbprivs => 1, pg_dumpall_dbprivs => 1,
section_pre_data => 1, section_pre_data => 1,
test_schema_plus_blobs => 1, test_schema_plus_blobs => 1, },
}, unlike => {
unlike => { binary_upgrade => 1,
binary_upgrade => 1, no_blobs => 1,
no_blobs => 1, only_dump_test_schema => 1,
only_dump_test_schema => 1, only_dump_test_table => 1,
only_dump_test_table => 1, pg_dumpall_globals => 1,
pg_dumpall_globals => 1, pg_dumpall_globals_clean => 1,
pg_dumpall_globals_clean => 1, role => 1,
role => 1, schema_only => 1,
schema_only => 1, section_data => 1,
section_data => 1, section_post_data => 1, }, },
section_post_data => 1,
},
},
'BLOB load (using lo_from_bytea)' => { 'BLOB load (using lo_from_bytea)' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QSELECT pg_catalog.lo_open\E \('\d+',\ \d+\);\n \QSELECT pg_catalog.lo_open\E \('\d+',\ \d+\);\n
\QSELECT pg_catalog.lowrite(0, \E \QSELECT pg_catalog.lowrite(0, \E
\Q'\x310a320a330a340a350a360a370a380a390a');\E\n \Q'\x310a320a330a340a350a360a370a380a390a');\E\n
\QSELECT pg_catalog.lo_close(0);\E \QSELECT pg_catalog.lo_close(0);\E
/xm, /xm,
like => { like => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
column_inserts => 1, column_inserts => 1,
createdb => 1, createdb => 1,
defaults => 1, defaults => 1,
data_only => 1, data_only => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, exclude_test_table => 1,
exclude_test_table_data => 1, exclude_test_table_data => 1,
no_owner => 1, no_owner => 1,
no_privs => 1, no_privs => 1,
pg_dumpall_dbprivs => 1, pg_dumpall_dbprivs => 1,
section_data => 1, section_data => 1,
test_schema_plus_blobs => 1, test_schema_plus_blobs => 1, },
}, unlike => {
unlike => { binary_upgrade => 1,
binary_upgrade => 1, no_blobs => 1,
no_blobs => 1, only_dump_test_schema => 1,
only_dump_test_schema => 1, only_dump_test_table => 1,
only_dump_test_table => 1, pg_dumpall_globals => 1,
pg_dumpall_globals => 1, pg_dumpall_globals_clean => 1,
pg_dumpall_globals_clean => 1, role => 1,
role => 1, schema_only => 1,
schema_only => 1, section_pre_data => 1,
section_pre_data => 1, section_post_data => 1, }, },
section_post_data => 1,
},
},
'COMMENT ON DATABASE postgres' => { 'COMMENT ON DATABASE postgres' => {
all_runs => 1, all_runs => 1,
catch_all => 'COMMENT commands', catch_all => 'COMMENT commands',
regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m, regexp => qr/^COMMENT ON DATABASE postgres IS .*;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
...@@ -741,15 +746,15 @@ my %tests = ( ...@@ -741,15 +746,15 @@ my %tests = (
schema_only => 1, schema_only => 1,
section_pre_data => 1, }, section_pre_data => 1, },
unlike => { unlike => {
only_dump_test_schema => 1, only_dump_test_schema => 1,
only_dump_test_table => 1, only_dump_test_table => 1,
role => 1, role => 1,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'COMMENT ON EXTENSION plpgsql' => { 'COMMENT ON EXTENSION plpgsql' => {
all_runs => 1, all_runs => 1,
catch_all => 'COMMENT commands', catch_all => 'COMMENT commands',
regexp => qr/^COMMENT ON EXTENSION plpgsql IS .*;/m, regexp => qr/^COMMENT ON EXTENSION plpgsql IS .*;/m,
like => { like => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
createdb => 1, createdb => 1,
...@@ -764,14 +769,14 @@ my %tests = ( ...@@ -764,14 +769,14 @@ my %tests = (
schema_only => 1, schema_only => 1,
section_pre_data => 1, }, section_pre_data => 1, },
unlike => { unlike => {
binary_upgrade => 1, binary_upgrade => 1,
only_dump_test_schema => 1, only_dump_test_schema => 1,
only_dump_test_table => 1, only_dump_test_table => 1,
role => 1, role => 1,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'COMMENT ON TABLE dump_test.test_table' => { 'COMMENT ON TABLE dump_test.test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'COMMENT commands', catch_all => 'COMMENT commands',
create_order => 36, create_order => 36,
create_sql => 'COMMENT ON TABLE dump_test.test_table create_sql => 'COMMENT ON TABLE dump_test.test_table
IS \'comment on table\';', IS \'comment on table\';',
...@@ -797,8 +802,8 @@ my %tests = ( ...@@ -797,8 +802,8 @@ my %tests = (
exclude_test_table => 1, exclude_test_table => 1,
role => 1, }, }, role => 1, }, },
'COMMENT ON COLUMN dump_test.test_table.col1' => { 'COMMENT ON COLUMN dump_test.test_table.col1' => {
all_runs => 1, all_runs => 1,
catch_all => 'COMMENT commands', catch_all => 'COMMENT commands',
create_order => 36, create_order => 36,
create_sql => 'COMMENT ON COLUMN dump_test.test_table.col1 create_sql => 'COMMENT ON COLUMN dump_test.test_table.col1
IS \'comment on column\';', IS \'comment on column\';',
...@@ -826,8 +831,8 @@ my %tests = ( ...@@ -826,8 +831,8 @@ my %tests = (
exclude_test_table => 1, exclude_test_table => 1,
role => 1, }, }, role => 1, }, },
'COMMENT ON COLUMN dump_test.composite.f1' => { 'COMMENT ON COLUMN dump_test.composite.f1' => {
all_runs => 1, all_runs => 1,
catch_all => 'COMMENT commands', catch_all => 'COMMENT commands',
create_order => 44, create_order => 44,
create_sql => 'COMMENT ON COLUMN dump_test.composite.f1 create_sql => 'COMMENT ON COLUMN dump_test.composite.f1
IS \'comment on column of type\';', IS \'comment on column of type\';',
...@@ -857,10 +862,10 @@ my %tests = ( ...@@ -857,10 +862,10 @@ my %tests = (
# catch-all for COMMENTs # catch-all for COMMENTs
'COMMENT commands' => { 'COMMENT commands' => {
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^COMMENT ON /m, regexp => qr/^COMMENT ON /m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
pg_dumpall_globals => 1, pg_dumpall_globals => 1,
...@@ -869,8 +874,8 @@ my %tests = ( ...@@ -869,8 +874,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'COPY test_table' => { 'COPY test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'COPY ... commands', catch_all => 'COPY ... commands',
create_order => 4, create_order => 4,
create_sql => 'INSERT INTO dump_test.test_table (col1) ' create_sql => 'INSERT INTO dump_test.test_table (col1) '
. 'SELECT generate_series FROM generate_series(1,9);', . 'SELECT generate_series FROM generate_series(1,9);',
...@@ -899,8 +904,8 @@ my %tests = ( ...@@ -899,8 +904,8 @@ my %tests = (
role => 1, }, }, role => 1, }, },
'COPY fk_reference_test_table' => { 'COPY fk_reference_test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'COPY ... commands', catch_all => 'COPY ... commands',
create_order => 22, create_order => 22,
create_sql => 'INSERT INTO dump_test.fk_reference_test_table (col1) ' create_sql => 'INSERT INTO dump_test.fk_reference_test_table (col1) '
. 'SELECT generate_series FROM generate_series(1,5);', . 'SELECT generate_series FROM generate_series(1,5);',
...@@ -932,20 +937,20 @@ my %tests = ( ...@@ -932,20 +937,20 @@ my %tests = (
# so this check is just making sure that the referring table comes after # so this check is just making sure that the referring table comes after
# the referred-to table. # the referred-to table.
'COPY fk_reference_test_table second' => { 'COPY fk_reference_test_table second' => {
all_runs => 0, # really only for data-only all_runs => 0, # really only for data-only
catch_all => 'COPY ... commands', catch_all => 'COPY ... commands',
regexp => qr/^ regexp => qr/^
\QCOPY test_table (col1) FROM stdin;\E \QCOPY test_table (col1) FROM stdin;\E
\n(?:\d\n){9}\\\.\n.* \n(?:\d\n){9}\\\.\n.*
\QCOPY fk_reference_test_table (col1) FROM stdin;\E \QCOPY fk_reference_test_table (col1) FROM stdin;\E
\n(?:\d\n){5}\\\.\n \n(?:\d\n){5}\\\.\n
/xms, /xms,
like => { data_only => 1, }, like => { data_only => 1, },
unlike => { }, }, unlike => {}, },
'COPY test_second_table' => { 'COPY test_second_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'COPY ... commands', catch_all => 'COPY ... commands',
create_order => 7, create_order => 7,
create_sql => 'INSERT INTO dump_test.test_second_table (col1, col2) ' create_sql => 'INSERT INTO dump_test.test_second_table (col1, col2) '
. 'SELECT generate_series, generate_series::text ' . 'SELECT generate_series, generate_series::text '
...@@ -975,8 +980,8 @@ my %tests = ( ...@@ -975,8 +980,8 @@ my %tests = (
role => 1, }, }, role => 1, }, },
'COPY test_third_table' => { 'COPY test_third_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'COPY ... commands', catch_all => 'COPY ... commands',
create_order => 12, create_order => 12,
create_sql => create_sql =>
'INSERT INTO dump_test_second_schema.test_third_table (col1) ' 'INSERT INTO dump_test_second_schema.test_third_table (col1) '
...@@ -1006,10 +1011,10 @@ my %tests = ( ...@@ -1006,10 +1011,10 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'COPY ... commands' => { # catch-all for COPY 'COPY ... commands' => { # catch-all for COPY
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^COPY /m, regexp => qr/^COPY /m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
binary_upgrade => 1, binary_upgrade => 1,
column_inserts => 1, column_inserts => 1,
pg_dumpall_globals => 1, pg_dumpall_globals => 1,
...@@ -1019,37 +1024,37 @@ my %tests = ( ...@@ -1019,37 +1024,37 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'INSERT INTO test_table' => { 'INSERT INTO test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'INSERT INTO ...', catch_all => 'INSERT INTO ...',
regexp => qr/^ regexp => qr/^
(?:INSERT\ INTO\ test_table\ \(col1\)\ VALUES\ \(\d\);\n){9} (?:INSERT\ INTO\ test_table\ \(col1\)\ VALUES\ \(\d\);\n){9}
/xm, /xm,
like => { column_inserts => 1, }, like => { column_inserts => 1, },
unlike => { }, }, unlike => {}, },
'INSERT INTO test_second_table' => { 'INSERT INTO test_second_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'INSERT INTO ...', catch_all => 'INSERT INTO ...',
regexp => qr/^ regexp => qr/^
(?:INSERT\ INTO\ test_second_table\ \(col1,\ col2\) (?:INSERT\ INTO\ test_second_table\ \(col1,\ col2\)
\ VALUES\ \(\d,\ '\d'\);\n){9}/xm, \ VALUES\ \(\d,\ '\d'\);\n){9}/xm,
like => { column_inserts => 1, }, like => { column_inserts => 1, },
unlike => { }, }, unlike => {}, },
'INSERT INTO test_third_table' => { 'INSERT INTO test_third_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'INSERT INTO ...', catch_all => 'INSERT INTO ...',
regexp => qr/^ regexp => qr/^
(?:INSERT\ INTO\ test_third_table\ \(col1\) (?:INSERT\ INTO\ test_third_table\ \(col1\)
\ VALUES\ \(\d\);\n){9}/xm, \ VALUES\ \(\d\);\n){9}/xm,
like => { column_inserts => 1, }, like => { column_inserts => 1, },
unlike => { }, }, unlike => {}, },
# INSERT INTO catch-all # INSERT INTO catch-all
'INSERT INTO ...' => { 'INSERT INTO ...' => {
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^INSERT INTO .* VALUES .*;/xm, regexp => qr/^INSERT INTO .* VALUES .*;/xm,
like => { }, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
binary_upgrade => 1, binary_upgrade => 1,
clean => 1, clean => 1,
...@@ -1077,7 +1082,7 @@ my %tests = ( ...@@ -1077,7 +1082,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE ROLE regress_dump_test_role' => { 'CREATE ROLE regress_dump_test_role' => {
all_runs => 1, all_runs => 1,
create_order => 1, create_order => 1,
create_sql => 'CREATE ROLE regress_dump_test_role;', create_sql => 'CREATE ROLE regress_dump_test_role;',
regexp => qr/^CREATE ROLE regress_dump_test_role;/m, regexp => qr/^CREATE ROLE regress_dump_test_role;/m,
...@@ -1110,34 +1115,35 @@ my %tests = ( ...@@ -1110,34 +1115,35 @@ my %tests = (
'CREATE CAST FOR timestamptz' => { 'CREATE CAST FOR timestamptz' => {
create_order => 51, create_order => 51,
create_sql => 'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;', create_sql =>
regexp => qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m, 'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;',
regexp =>
qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
createdb => 1, createdb => 1,
defaults => 1, defaults => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, exclude_test_table => 1,
exclude_test_table_data => 1, exclude_test_table_data => 1,
no_blobs => 1, no_blobs => 1,
no_privs => 1, no_privs => 1,
no_owner => 1, no_owner => 1,
pg_dumpall_dbprivs => 1, pg_dumpall_dbprivs => 1,
schema_only => 1, schema_only => 1,
section_pre_data => 1, section_pre_data => 1, },
}, unlike => {
unlike => { only_dump_test_schema => 1,
only_dump_test_schema => 1, only_dump_test_table => 1,
only_dump_test_table => 1, pg_dumpall_globals => 1,
pg_dumpall_globals => 1, section_post_data => 1,
section_post_data => 1,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE DATABASE postgres' => { 'CREATE DATABASE postgres' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QCREATE DATABASE postgres WITH TEMPLATE = template0 \E \QCREATE DATABASE postgres WITH TEMPLATE = template0 \E
.*;/xm, .*;/xm,
like => { createdb => 1, }, like => { createdb => 1, },
...@@ -1167,7 +1173,7 @@ my %tests = ( ...@@ -1167,7 +1173,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE DATABASE dump_test' => { 'CREATE DATABASE dump_test' => {
all_runs => 1, all_runs => 1,
create_order => 47, create_order => 47,
create_sql => 'CREATE DATABASE dump_test;', create_sql => 'CREATE DATABASE dump_test;',
regexp => qr/^ regexp => qr/^
...@@ -1201,7 +1207,7 @@ my %tests = ( ...@@ -1201,7 +1207,7 @@ my %tests = (
'CREATE EXTENSION ... plpgsql' => { 'CREATE EXTENSION ... plpgsql' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\E \QCREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;\E
/xm, /xm,
like => { like => {
...@@ -1232,7 +1238,7 @@ my %tests = ( ...@@ -1232,7 +1238,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE AGGREGATE dump_test.newavg' => { 'CREATE AGGREGATE dump_test.newavg' => {
all_runs => 1, all_runs => 1,
create_order => 25, create_order => 25,
create_sql => 'CREATE AGGREGATE dump_test.newavg ( create_sql => 'CREATE AGGREGATE dump_test.newavg (
sfunc = int4_avg_accum, sfunc = int4_avg_accum,
...@@ -1276,7 +1282,7 @@ my %tests = ( ...@@ -1276,7 +1282,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE DOMAIN dump_test.us_postal_code' => { 'CREATE DOMAIN dump_test.us_postal_code' => {
all_runs => 1, all_runs => 1,
create_order => 29, create_order => 29,
create_sql => 'CREATE DOMAIN dump_test.us_postal_code AS TEXT create_sql => 'CREATE DOMAIN dump_test.us_postal_code AS TEXT
CHECK(VALUE ~ \'^\d{5}$\' OR CHECK(VALUE ~ \'^\d{5}$\' OR
...@@ -1317,7 +1323,7 @@ my %tests = ( ...@@ -1317,7 +1323,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FUNCTION dump_test.pltestlang_call_handler' => { 'CREATE FUNCTION dump_test.pltestlang_call_handler' => {
all_runs => 1, all_runs => 1,
create_order => 17, create_order => 17,
create_sql => 'CREATE FUNCTION dump_test.pltestlang_call_handler() create_sql => 'CREATE FUNCTION dump_test.pltestlang_call_handler()
RETURNS LANGUAGE_HANDLER AS \'$libdir/plpgsql\', RETURNS LANGUAGE_HANDLER AS \'$libdir/plpgsql\',
...@@ -1357,7 +1363,7 @@ my %tests = ( ...@@ -1357,7 +1363,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FUNCTION dump_test.trigger_func' => { 'CREATE FUNCTION dump_test.trigger_func' => {
all_runs => 1, all_runs => 1,
create_order => 30, create_order => 30,
create_sql => 'CREATE FUNCTION dump_test.trigger_func() create_sql => 'CREATE FUNCTION dump_test.trigger_func()
RETURNS trigger LANGUAGE plpgsql RETURNS trigger LANGUAGE plpgsql
...@@ -1396,7 +1402,7 @@ my %tests = ( ...@@ -1396,7 +1402,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FUNCTION dump_test.event_trigger_func' => { 'CREATE FUNCTION dump_test.event_trigger_func' => {
all_runs => 1, all_runs => 1,
create_order => 32, create_order => 32,
create_sql => 'CREATE FUNCTION dump_test.event_trigger_func() create_sql => 'CREATE FUNCTION dump_test.event_trigger_func()
RETURNS event_trigger LANGUAGE plpgsql RETURNS event_trigger LANGUAGE plpgsql
...@@ -1435,7 +1441,7 @@ my %tests = ( ...@@ -1435,7 +1441,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE EVENT TRIGGER test_event_trigger' => { 'CREATE EVENT TRIGGER test_event_trigger' => {
all_runs => 1, all_runs => 1,
create_order => 33, create_order => 33,
create_sql => 'CREATE EVENT TRIGGER test_event_trigger create_sql => 'CREATE EVENT TRIGGER test_event_trigger
ON ddl_command_start ON ddl_command_start
...@@ -1473,7 +1479,7 @@ my %tests = ( ...@@ -1473,7 +1479,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE TRIGGER test_trigger' => { 'CREATE TRIGGER test_trigger' => {
all_runs => 1, all_runs => 1,
create_order => 31, create_order => 31,
create_sql => 'CREATE TRIGGER test_trigger create_sql => 'CREATE TRIGGER test_trigger
BEFORE INSERT ON dump_test.test_table BEFORE INSERT ON dump_test.test_table
...@@ -1512,7 +1518,7 @@ my %tests = ( ...@@ -1512,7 +1518,7 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE TYPE dump_test.planets AS ENUM' => { 'CREATE TYPE dump_test.planets AS ENUM' => {
all_runs => 1, all_runs => 1,
create_order => 37, create_order => 37,
create_sql => 'CREATE TYPE dump_test.planets create_sql => 'CREATE TYPE dump_test.planets
AS ENUM ( \'venus\', \'earth\', \'mars\' );', AS ENUM ( \'venus\', \'earth\', \'mars\' );',
...@@ -1551,7 +1557,7 @@ my %tests = ( ...@@ -1551,7 +1557,7 @@ my %tests = (
'CREATE TYPE dump_test.planets AS ENUM pg_upgrade' => { 'CREATE TYPE dump_test.planets AS ENUM pg_upgrade' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QCREATE TYPE planets AS ENUM (\E \QCREATE TYPE planets AS ENUM (\E
\n\);.*^ \n\);.*^
\QALTER TYPE dump_test.planets ADD VALUE 'venus';\E \QALTER TYPE dump_test.planets ADD VALUE 'venus';\E
...@@ -1588,7 +1594,7 @@ my %tests = ( ...@@ -1588,7 +1594,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TYPE dump_test.textrange AS RANGE' => { 'CREATE TYPE dump_test.textrange AS RANGE' => {
all_runs => 1, all_runs => 1,
create_order => 38, create_order => 38,
create_sql => 'CREATE TYPE dump_test.textrange create_sql => 'CREATE TYPE dump_test.textrange
AS RANGE (subtype=text, collation="C");', AS RANGE (subtype=text, collation="C");',
...@@ -1625,7 +1631,7 @@ my %tests = ( ...@@ -1625,7 +1631,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TYPE dump_test.int42' => { 'CREATE TYPE dump_test.int42' => {
all_runs => 1, all_runs => 1,
create_order => 39, create_order => 39,
create_sql => 'CREATE TYPE dump_test.int42;', create_sql => 'CREATE TYPE dump_test.int42;',
regexp => qr/^CREATE TYPE int42;/m, regexp => qr/^CREATE TYPE int42;/m,
...@@ -1657,7 +1663,7 @@ my %tests = ( ...@@ -1657,7 +1663,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FUNCTION dump_test.int42_in' => { 'CREATE FUNCTION dump_test.int42_in' => {
all_runs => 1, all_runs => 1,
create_order => 40, create_order => 40,
create_sql => 'CREATE FUNCTION dump_test.int42_in(cstring) create_sql => 'CREATE FUNCTION dump_test.int42_in(cstring)
RETURNS dump_test.int42 AS \'int4in\' RETURNS dump_test.int42 AS \'int4in\'
...@@ -1695,7 +1701,7 @@ my %tests = ( ...@@ -1695,7 +1701,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FUNCTION dump_test.int42_out' => { 'CREATE FUNCTION dump_test.int42_out' => {
all_runs => 1, all_runs => 1,
create_order => 41, create_order => 41,
create_sql => 'CREATE FUNCTION dump_test.int42_out(dump_test.int42) create_sql => 'CREATE FUNCTION dump_test.int42_out(dump_test.int42)
RETURNS cstring AS \'int4out\' RETURNS cstring AS \'int4out\'
...@@ -1733,7 +1739,7 @@ my %tests = ( ...@@ -1733,7 +1739,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TYPE dump_test.int42 populated' => { 'CREATE TYPE dump_test.int42 populated' => {
all_runs => 1, all_runs => 1,
create_order => 42, create_order => 42,
create_sql => 'CREATE TYPE dump_test.int42 ( create_sql => 'CREATE TYPE dump_test.int42 (
internallength = 4, internallength = 4,
...@@ -1780,7 +1786,7 @@ my %tests = ( ...@@ -1780,7 +1786,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TYPE dump_test.composite' => { 'CREATE TYPE dump_test.composite' => {
all_runs => 1, all_runs => 1,
create_order => 43, create_order => 43,
create_sql => 'CREATE TYPE dump_test.composite AS ( create_sql => 'CREATE TYPE dump_test.composite AS (
f1 int, f1 int,
...@@ -1820,7 +1826,7 @@ my %tests = ( ...@@ -1820,7 +1826,7 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE FOREIGN DATA WRAPPER dummy' => { 'CREATE FOREIGN DATA WRAPPER dummy' => {
all_runs => 1, all_runs => 1,
create_order => 35, create_order => 35,
create_sql => 'CREATE FOREIGN DATA WRAPPER dummy;', create_sql => 'CREATE FOREIGN DATA WRAPPER dummy;',
regexp => qr/CREATE FOREIGN DATA WRAPPER dummy;/m, regexp => qr/CREATE FOREIGN DATA WRAPPER dummy;/m,
...@@ -1852,7 +1858,7 @@ my %tests = ( ...@@ -1852,7 +1858,7 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy' => { 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy' => {
all_runs => 1, all_runs => 1,
create_order => 36, create_order => 36,
create_sql => 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;', create_sql => 'CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;',
regexp => qr/CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;/m, regexp => qr/CREATE SERVER s1 FOREIGN DATA WRAPPER dummy;/m,
...@@ -1885,34 +1891,35 @@ my %tests = ( ...@@ -1885,34 +1891,35 @@ my %tests = (
'CREATE TRANSFORM FOR int' => { 'CREATE TRANSFORM FOR int' => {
create_order => 34, create_order => 34,
create_sql => 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_transform(internal), TO SQL WITH FUNCTION int4recv(internal));', create_sql =>
regexp => qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog\.varchar_transform\(internal\), TO SQL WITH FUNCTION pg_catalog\.int4recv\(internal\)\);/m, 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_transform(internal), TO SQL WITH FUNCTION int4recv(internal));',
regexp =>
qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog\.varchar_transform\(internal\), TO SQL WITH FUNCTION pg_catalog\.int4recv\(internal\)\);/m,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
createdb => 1, createdb => 1,
defaults => 1, defaults => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, exclude_test_table => 1,
exclude_test_table_data => 1, exclude_test_table_data => 1,
no_blobs => 1, no_blobs => 1,
no_privs => 1, no_privs => 1,
no_owner => 1, no_owner => 1,
pg_dumpall_dbprivs => 1, pg_dumpall_dbprivs => 1,
schema_only => 1, schema_only => 1,
section_pre_data => 1, section_pre_data => 1, },
}, unlike => {
unlike => { only_dump_test_schema => 1,
only_dump_test_schema => 1, only_dump_test_table => 1,
only_dump_test_table => 1, pg_dumpall_globals => 1,
pg_dumpall_globals => 1, section_post_data => 1,
section_post_data => 1,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE LANGUAGE pltestlang' => { 'CREATE LANGUAGE pltestlang' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 18, create_order => 18,
create_sql => 'CREATE LANGUAGE pltestlang create_sql => 'CREATE LANGUAGE pltestlang
HANDLER dump_test.pltestlang_call_handler;', HANDLER dump_test.pltestlang_call_handler;',
...@@ -1945,8 +1952,8 @@ my %tests = ( ...@@ -1945,8 +1952,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE MATERIALIZED VIEW matview' => { 'CREATE MATERIALIZED VIEW matview' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 20, create_order => 20,
create_sql => 'CREATE MATERIALIZED VIEW dump_test.matview (col1) AS create_sql => 'CREATE MATERIALIZED VIEW dump_test.matview (col1) AS
SELECT * FROM dump_test.test_table;', SELECT * FROM dump_test.test_table;',
...@@ -1981,8 +1988,8 @@ my %tests = ( ...@@ -1981,8 +1988,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE MATERIALIZED VIEW matview_second' => { 'CREATE MATERIALIZED VIEW matview_second' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 21, create_order => 21,
create_sql => 'CREATE MATERIALIZED VIEW create_sql => 'CREATE MATERIALIZED VIEW
dump_test.matview_second (col1) AS dump_test.matview_second (col1) AS
...@@ -2018,8 +2025,8 @@ my %tests = ( ...@@ -2018,8 +2025,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE POLICY p1 ON test_table' => { 'CREATE POLICY p1 ON test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 22, create_order => 22,
create_sql => 'CREATE POLICY p1 ON dump_test.test_table create_sql => 'CREATE POLICY p1 ON dump_test.test_table
USING (true) USING (true)
...@@ -2053,8 +2060,8 @@ my %tests = ( ...@@ -2053,8 +2060,8 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE POLICY p2 ON test_table FOR SELECT' => { 'CREATE POLICY p2 ON test_table FOR SELECT' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 24, create_order => 24,
create_sql => 'CREATE POLICY p2 ON dump_test.test_table create_sql => 'CREATE POLICY p2 ON dump_test.test_table
FOR SELECT TO regress_dump_test_role USING (true);', FOR SELECT TO regress_dump_test_role USING (true);',
...@@ -2087,8 +2094,8 @@ my %tests = ( ...@@ -2087,8 +2094,8 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE POLICY p3 ON test_table FOR INSERT' => { 'CREATE POLICY p3 ON test_table FOR INSERT' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 25, create_order => 25,
create_sql => 'CREATE POLICY p3 ON dump_test.test_table create_sql => 'CREATE POLICY p3 ON dump_test.test_table
FOR INSERT TO regress_dump_test_role WITH CHECK (true);', FOR INSERT TO regress_dump_test_role WITH CHECK (true);',
...@@ -2121,8 +2128,8 @@ my %tests = ( ...@@ -2121,8 +2128,8 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE POLICY p4 ON test_table FOR UPDATE' => { 'CREATE POLICY p4 ON test_table FOR UPDATE' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 26, create_order => 26,
create_sql => 'CREATE POLICY p4 ON dump_test.test_table FOR UPDATE create_sql => 'CREATE POLICY p4 ON dump_test.test_table FOR UPDATE
TO regress_dump_test_role USING (true) WITH CHECK (true);', TO regress_dump_test_role USING (true) WITH CHECK (true);',
...@@ -2155,8 +2162,8 @@ my %tests = ( ...@@ -2155,8 +2162,8 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE POLICY p5 ON test_table FOR DELETE' => { 'CREATE POLICY p5 ON test_table FOR DELETE' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 27, create_order => 27,
create_sql => 'CREATE POLICY p5 ON dump_test.test_table create_sql => 'CREATE POLICY p5 ON dump_test.test_table
FOR DELETE TO regress_dump_test_role USING (true);', FOR DELETE TO regress_dump_test_role USING (true);',
...@@ -2189,7 +2196,7 @@ my %tests = ( ...@@ -2189,7 +2196,7 @@ my %tests = (
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE POLICY p6 ON test_table AS RESTRICTIVE' => { 'CREATE POLICY p6 ON test_table AS RESTRICTIVE' => {
create_order => 27, create_order => 27,
create_sql => 'CREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE create_sql => 'CREATE POLICY p6 ON dump_test.test_table AS RESTRICTIVE
USING (false);', USING (false);',
regexp => qr/^ regexp => qr/^
\QCREATE POLICY p6 ON test_table AS RESTRICTIVE \E \QCREATE POLICY p6 ON test_table AS RESTRICTIVE \E
...@@ -2216,38 +2223,39 @@ my %tests = ( ...@@ -2216,38 +2223,39 @@ my %tests = (
pg_dumpall_globals => 1, pg_dumpall_globals => 1,
pg_dumpall_globals_clean => 1, pg_dumpall_globals_clean => 1,
role => 1, role => 1,
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'CREATE PUBLICATION pub1' => { 'CREATE PUBLICATION pub1' => {
create_order => 50, create_order => 50,
create_sql => 'CREATE PUBLICATION pub1;', create_sql => 'CREATE PUBLICATION pub1;',
regexp => qr/^ regexp => qr/^
\QCREATE PUBLICATION pub1 WITH (PUBLISH INSERT, PUBLISH UPDATE, PUBLISH DELETE);\E \QCREATE PUBLICATION pub1 WITH (PUBLISH INSERT, PUBLISH UPDATE, PUBLISH DELETE);\E
/xm, /xm,
like => { like => {
binary_upgrade => 1, binary_upgrade => 1,
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
createdb => 1, createdb => 1,
defaults => 1, defaults => 1,
exclude_test_table_data => 1, exclude_test_table_data => 1,
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, exclude_test_table => 1,
no_privs => 1, no_privs => 1,
no_owner => 1, no_owner => 1,
only_dump_test_schema => 1, only_dump_test_schema => 1,
only_dump_test_table => 1, only_dump_test_table => 1,
pg_dumpall_dbprivs => 1, pg_dumpall_dbprivs => 1,
schema_only => 1, schema_only => 1,
section_post_data => 1, section_post_data => 1,
test_schema_plus_blobs => 1, }, test_schema_plus_blobs => 1, },
unlike => { unlike => {
section_pre_data => 1, section_pre_data => 1,
pg_dumpall_globals => 1, pg_dumpall_globals => 1,
pg_dumpall_globals_clean => 1, }, }, pg_dumpall_globals_clean => 1, }, },
'ALTER PUBLICATION pub1 ADD TABLE test_table' => { 'ALTER PUBLICATION pub1 ADD TABLE test_table' => {
create_order => 51, create_order => 51,
create_sql => 'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;', create_sql =>
'ALTER PUBLICATION pub1 ADD TABLE dump_test.test_table;',
regexp => qr/^ regexp => qr/^
\QALTER PUBLICATION pub1 ADD TABLE test_table;\E \QALTER PUBLICATION pub1 ADD TABLE test_table;\E
/xm, /xm,
...@@ -2274,8 +2282,8 @@ my %tests = ( ...@@ -2274,8 +2282,8 @@ my %tests = (
pg_dumpall_globals_clean => 1, }, }, pg_dumpall_globals_clean => 1, }, },
'CREATE SCHEMA dump_test' => { 'CREATE SCHEMA dump_test' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 2, create_order => 2,
create_sql => 'CREATE SCHEMA dump_test;', create_sql => 'CREATE SCHEMA dump_test;',
regexp => qr/^CREATE SCHEMA dump_test;/m, regexp => qr/^CREATE SCHEMA dump_test;/m,
...@@ -2304,8 +2312,8 @@ my %tests = ( ...@@ -2304,8 +2312,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE SCHEMA dump_test_second_schema' => { 'CREATE SCHEMA dump_test_second_schema' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 9, create_order => 9,
create_sql => 'CREATE SCHEMA dump_test_second_schema;', create_sql => 'CREATE SCHEMA dump_test_second_schema;',
regexp => qr/^CREATE SCHEMA dump_test_second_schema;/m, regexp => qr/^CREATE SCHEMA dump_test_second_schema;/m,
...@@ -2334,8 +2342,8 @@ my %tests = ( ...@@ -2334,8 +2342,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE TABLE test_table' => { 'CREATE TABLE test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 3, create_order => 3,
create_sql => 'CREATE TABLE dump_test.test_table ( create_sql => 'CREATE TABLE dump_test.test_table (
col1 serial primary key, col1 serial primary key,
...@@ -2372,8 +2380,8 @@ my %tests = ( ...@@ -2372,8 +2380,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TABLE fk_reference_test_table' => { 'CREATE TABLE fk_reference_test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 21, create_order => 21,
create_sql => 'CREATE TABLE dump_test.fk_reference_test_table ( create_sql => 'CREATE TABLE dump_test.fk_reference_test_table (
col1 int primary key references dump_test.test_table col1 int primary key references dump_test.test_table
...@@ -2408,8 +2416,8 @@ my %tests = ( ...@@ -2408,8 +2416,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TABLE test_second_table' => { 'CREATE TABLE test_second_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 6, create_order => 6,
create_sql => 'CREATE TABLE dump_test.test_second_table ( create_sql => 'CREATE TABLE dump_test.test_second_table (
col1 int, col1 int,
...@@ -2446,8 +2454,8 @@ my %tests = ( ...@@ -2446,8 +2454,8 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE TABLE test_third_table' => { 'CREATE TABLE test_third_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 11, create_order => 11,
create_sql => 'CREATE TABLE dump_test_second_schema.test_third_table ( create_sql => 'CREATE TABLE dump_test_second_schema.test_third_table (
col1 serial col1 serial
...@@ -2482,9 +2490,9 @@ my %tests = ( ...@@ -2482,9 +2490,9 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE SEQUENCE test_table_col1_seq' => { 'CREATE SEQUENCE test_table_col1_seq' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
regexp => qr/^ regexp => qr/^
\QCREATE SEQUENCE test_table_col1_seq\E \QCREATE SEQUENCE test_table_col1_seq\E
\n\s+\QSTART WITH 1\E \n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E \n\s+\QINCREMENT BY 1\E
...@@ -2517,9 +2525,9 @@ my %tests = ( ...@@ -2517,9 +2525,9 @@ my %tests = (
section_post_data => 1, }, }, section_post_data => 1, }, },
'CREATE SEQUENCE test_third_table_col1_seq' => { 'CREATE SEQUENCE test_third_table_col1_seq' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
regexp => qr/^ regexp => qr/^
\QCREATE SEQUENCE test_third_table_col1_seq\E \QCREATE SEQUENCE test_third_table_col1_seq\E
\n\s+\QSTART WITH 1\E \n\s+\QSTART WITH 1\E
\n\s+\QINCREMENT BY 1\E \n\s+\QINCREMENT BY 1\E
...@@ -2552,8 +2560,8 @@ my %tests = ( ...@@ -2552,8 +2560,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE UNIQUE INDEX test_third_table_idx ON test_third_table' => { 'CREATE UNIQUE INDEX test_third_table_idx ON test_third_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 13, create_order => 13,
create_sql => 'CREATE UNIQUE INDEX test_third_table_idx create_sql => 'CREATE UNIQUE INDEX test_third_table_idx
ON dump_test_second_schema.test_third_table (col1);', ON dump_test_second_schema.test_third_table (col1);',
...@@ -2586,20 +2594,20 @@ my %tests = ( ...@@ -2586,20 +2594,20 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'CREATE ... commands' => { # catch-all for CREATE 'CREATE ... commands' => { # catch-all for CREATE
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^CREATE /m, regexp => qr/^CREATE /m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
section_data => 1, }, }, section_data => 1, }, },
'DROP EXTENSION plpgsql' => { 'DROP EXTENSION plpgsql' => {
all_runs => 1, all_runs => 1,
catch_all => 'DROP ... commands', catch_all => 'DROP ... commands',
regexp => qr/^DROP EXTENSION plpgsql;/m, regexp => qr/^DROP EXTENSION plpgsql;/m,
like => { clean => 1, }, like => { clean => 1, },
unlike => { unlike => {
clean_if_exists => 1, clean_if_exists => 1,
pg_dumpall_globals_clean => 1, }, }, pg_dumpall_globals_clean => 1, }, },
...@@ -2732,17 +2740,17 @@ my %tests = ( ...@@ -2732,17 +2740,17 @@ my %tests = (
regexp => qr/^ regexp => qr/^
\QDROP ROLE pg_\E.*; \QDROP ROLE pg_\E.*;
/xm, /xm,
like => { }, like => {},
unlike => { unlike => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
pg_dumpall_globals_clean => 1, }, }, pg_dumpall_globals_clean => 1, }, },
'DROP ... commands' => { # catch-all for DROP 'DROP ... commands' => { # catch-all for DROP
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^DROP /m, regexp => qr/^DROP /m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
binary_upgrade => 1, binary_upgrade => 1,
column_inserts => 1, column_inserts => 1,
createdb => 1, createdb => 1,
...@@ -2766,8 +2774,8 @@ my %tests = ( ...@@ -2766,8 +2774,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT USAGE ON SCHEMA dump_test_second_schema' => { 'GRANT USAGE ON SCHEMA dump_test_second_schema' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 10, create_order => 10,
create_sql => 'GRANT USAGE ON SCHEMA dump_test_second_schema create_sql => 'GRANT USAGE ON SCHEMA dump_test_second_schema
TO regress_dump_test_role;', TO regress_dump_test_role;',
...@@ -2796,8 +2804,8 @@ my %tests = ( ...@@ -2796,8 +2804,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT CREATE ON DATABASE dump_test' => { 'GRANT CREATE ON DATABASE dump_test' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 48, create_order => 48,
create_sql => create_sql =>
'GRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;', 'GRANT CREATE ON DATABASE dump_test TO regress_dump_test_role;',
...@@ -2825,8 +2833,8 @@ my %tests = ( ...@@ -2825,8 +2833,8 @@ my %tests = (
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT SELECT ON TABLE test_table' => { 'GRANT SELECT ON TABLE test_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 5, create_order => 5,
create_sql => 'GRANT SELECT ON TABLE dump_test.test_table create_sql => 'GRANT SELECT ON TABLE dump_test.test_table
TO regress_dump_test_role;', TO regress_dump_test_role;',
...@@ -2854,8 +2862,8 @@ my %tests = ( ...@@ -2854,8 +2862,8 @@ my %tests = (
role => 1, }, }, role => 1, }, },
'GRANT SELECT ON TABLE test_third_table' => { 'GRANT SELECT ON TABLE test_third_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 19, create_order => 19,
create_sql => 'GRANT SELECT ON create_sql => 'GRANT SELECT ON
TABLE dump_test_second_schema.test_third_table TABLE dump_test_second_schema.test_third_table
...@@ -2884,8 +2892,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -2884,8 +2892,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT ALL ON SEQUENCE test_third_table_col1_seq' => { 'GRANT ALL ON SEQUENCE test_third_table_col1_seq' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 28, create_order => 28,
create_sql => 'GRANT ALL ON SEQUENCE create_sql => 'GRANT ALL ON SEQUENCE
dump_test_second_schema.test_third_table_col1_seq dump_test_second_schema.test_third_table_col1_seq
...@@ -2915,8 +2923,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -2915,8 +2923,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT INSERT(col1) ON TABLE test_second_table' => { 'GRANT INSERT(col1) ON TABLE test_second_table' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 8, create_order => 8,
create_sql => create_sql =>
'GRANT INSERT (col1) ON TABLE dump_test.test_second_table 'GRANT INSERT (col1) ON TABLE dump_test.test_second_table
...@@ -2946,8 +2954,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -2946,8 +2954,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
role => 1, }, }, role => 1, }, },
'GRANT EXECUTE ON FUNCTION pg_sleep() TO regress_dump_test_role' => { 'GRANT EXECUTE ON FUNCTION pg_sleep() TO regress_dump_test_role' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 16, create_order => 16,
create_sql => 'GRANT EXECUTE ON FUNCTION pg_sleep(float8) create_sql => 'GRANT EXECUTE ON FUNCTION pg_sleep(float8)
TO regress_dump_test_role;', TO regress_dump_test_role;',
...@@ -2976,8 +2984,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -2976,8 +2984,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT SELECT (proname ...) ON TABLE pg_proc TO public' => { 'GRANT SELECT (proname ...) ON TABLE pg_proc TO public' => {
all_runs => 1, all_runs => 1,
catch_all => 'GRANT commands', catch_all => 'GRANT commands',
create_order => 46, create_order => 46,
create_sql => 'GRANT SELECT ( create_sql => 'GRANT SELECT (
tableoid, tableoid,
...@@ -3066,10 +3074,10 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3066,10 +3074,10 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'GRANT commands' => { # catch-all for GRANT commands 'GRANT commands' => { # catch-all for GRANT commands
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^GRANT /m, regexp => qr/^GRANT /m,
like => { }, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
no_privs => 1, no_privs => 1,
...@@ -3079,8 +3087,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3079,8 +3087,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview' => { 'REFRESH MATERIALIZED VIEW matview' => {
all_runs => 1, all_runs => 1,
regexp => qr/^REFRESH MATERIALIZED VIEW matview;/m, regexp => qr/^REFRESH MATERIALIZED VIEW matview;/m,
like => { like => {
clean => 1, clean => 1,
clean_if_exists => 1, clean_if_exists => 1,
createdb => 1, createdb => 1,
...@@ -3109,7 +3117,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3109,7 +3117,7 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
'REFRESH MATERIALIZED VIEW matview_second' => { 'REFRESH MATERIALIZED VIEW matview_second' => {
all_runs => 1, all_runs => 1,
regexp => qr/^ regexp => qr/^
\QREFRESH MATERIALIZED VIEW matview;\E \QREFRESH MATERIALIZED VIEW matview;\E
\n.* \n.*
\QREFRESH MATERIALIZED VIEW matview_second;\E \QREFRESH MATERIALIZED VIEW matview_second;\E
...@@ -3142,8 +3150,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3142,8 +3150,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
section_pre_data => 1, }, }, section_pre_data => 1, }, },
'REVOKE CONNECT ON DATABASE dump_test FROM public' => { 'REVOKE CONNECT ON DATABASE dump_test FROM public' => {
all_runs => 1, all_runs => 1,
catch_all => 'REVOKE commands', catch_all => 'REVOKE commands',
create_order => 49, create_order => 49,
create_sql => 'REVOKE CONNECT ON DATABASE dump_test FROM public;', create_sql => 'REVOKE CONNECT ON DATABASE dump_test FROM public;',
regexp => qr/^ regexp => qr/^
...@@ -3175,8 +3183,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3175,8 +3183,8 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'REVOKE EXECUTE ON FUNCTION pg_sleep() FROM public' => { 'REVOKE EXECUTE ON FUNCTION pg_sleep() FROM public' => {
all_runs => 1, all_runs => 1,
catch_all => 'REVOKE commands', catch_all => 'REVOKE commands',
create_order => 15, create_order => 15,
create_sql => 'REVOKE EXECUTE ON FUNCTION pg_sleep(float8) create_sql => 'REVOKE EXECUTE ON FUNCTION pg_sleep(float8)
FROM public;', FROM public;',
...@@ -3291,10 +3299,10 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m, ...@@ -3291,10 +3299,10 @@ qr/^GRANT SELECT ON TABLE test_third_table TO regress_dump_test_role;/m,
test_schema_plus_blobs => 1, }, }, test_schema_plus_blobs => 1, }, },
'REVOKE commands' => { # catch-all for REVOKE commands 'REVOKE commands' => { # catch-all for REVOKE commands
all_runs => 0, # catch-all all_runs => 0, # catch-all
regexp => qr/^REVOKE /m, regexp => qr/^REVOKE /m,
like => {}, # use more-specific options above like => {}, # use more-specific options above
unlike => { unlike => {
column_inserts => 1, column_inserts => 1,
data_only => 1, data_only => 1,
no_privs => 1, no_privs => 1,
...@@ -3440,21 +3448,24 @@ foreach my $run (sort keys %pgdump_runs) ...@@ -3440,21 +3448,24 @@ foreach my $run (sort keys %pgdump_runs)
$tests{$test}->{regexp}, $tests{$test}->{regexp},
"$run: does not dump $test"); "$run: does not dump $test");
} }
# Complain if there isn't a like or unlike for this test, unless that is ok
# Complain if there isn't a like or unlike for this test, unless that is ok
if ($tests{$test}->{all_runs}) if ($tests{$test}->{all_runs})
{ {
if (!defined($tests{$test}->{catch_all})) if (!defined($tests{$test}->{catch_all}))
{ {
ok (defined($tests{$test}->{like}->{$test_key}) || defined($tests{$test}->{unlike}->{$test_key}), "$run defined for `$test'"); ok( defined($tests{$test}->{like}->{$test_key})
|| defined($tests{$test}->{unlike}->{$test_key}),
"$run defined for `$test'");
} }
else else
{ {
my $catch_all = $tests{$test}->{catch_all}; my $catch_all = $tests{$test}->{catch_all};
ok (defined($tests{$test}->{like}->{$test_key}) || ok( defined($tests{$test}->{like}->{$test_key})
defined($tests{$catch_all}->{like}->{$test_key}) || || defined($tests{$catch_all}->{like}->{$test_key})
defined($tests{$test}->{unlike}->{$test_key}) || || defined($tests{$test}->{unlike}->{$test_key})
defined($tests{$catch_all}->{unlike}->{$test_key}), || defined($tests{$catch_all}->{unlike}->{$test_key}),
"$run defined for `$test' or `$catch_all'"); "$run defined for `$test' or `$catch_all'");
} }
} }
......
...@@ -9,116 +9,141 @@ use Test::More tests => 14; ...@@ -9,116 +9,141 @@ use Test::More tests => 14;
# interpret everything as UTF8. We're going to use byte sequences # interpret everything as UTF8. We're going to use byte sequences
# that aren't valid UTF-8 strings, so that would fail. Use LATIN1, # that aren't valid UTF-8 strings, so that would fail. Use LATIN1,
# which accepts any byte and has a conversion from each byte to UTF-8. # which accepts any byte and has a conversion from each byte to UTF-8.
$ENV{LC_ALL} = 'C'; $ENV{LC_ALL} = 'C';
$ENV{PGCLIENTENCODING} = 'LATIN1'; $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.
my $dbname1 = generate_ascii_string(1, 9) . my $dbname1 =
generate_ascii_string(11, 12) . generate_ascii_string(1, 9)
generate_ascii_string(14, 33) . . generate_ascii_string(11, 12)
($TestLib::windows_os ? '' : '"x"') . # IPC::Run mishandles '"' on Windows . generate_ascii_string(14, 33)
generate_ascii_string(35, 43) . . ($TestLib::windows_os ? '' : '"x"')
generate_ascii_string(45, 63); # contains '=' . # IPC::Run mishandles '"' on Windows
my $dbname2 = generate_ascii_string(67, 129); # skip 64-66 to keep length to 62 generate_ascii_string(35, 43)
. generate_ascii_string(45, 63); # contains '='
my $dbname2 =
generate_ascii_string(67, 129); # skip 64-66 to keep length to 62
my $dbname3 = generate_ascii_string(130, 192); my $dbname3 = generate_ascii_string(130, 192);
my $dbname4 = generate_ascii_string(193, 255); my $dbname4 = generate_ascii_string(193, 255);
my $node = get_new_node('main'); my $node = get_new_node('main');
$node->init(extra => ['--locale=C', '--encoding=LATIN1']); $node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]);
# prep pg_hba.conf and pg_ident.conf # prep pg_hba.conf and pg_ident.conf
$node->run_log([$ENV{PG_REGRESS}, '--config-auth', $node->data_dir, $node->run_log(
'--create-role', "$dbname1,$dbname2,$dbname3,$dbname4"]); [ $ENV{PG_REGRESS}, '--config-auth',
$node->data_dir, '--create-role',
"$dbname1,$dbname2,$dbname3,$dbname4" ]);
$node->start; $node->start;
my $backupdir = $node->backup_dir; my $backupdir = $node->backup_dir;
my $discard = "$backupdir/discard.sql"; 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') foreach my $dbname ($dbname1, $dbname2, $dbname3, $dbname4, 'CamelCase')
{ {
$node->run_log(['createdb', $dbname]); $node->run_log([ 'createdb', $dbname ]);
$node->run_log(['createuser', '-s', $dbname]); $node->run_log([ 'createuser', '-s', $dbname ]);
} }
# 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
# dump. # dump.
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname', $node->command_ok(
$node->connstr($dbname1), '-U', $dbname4], [ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
'pg_dumpall with long ASCII name 1'); $node->connstr($dbname1),
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname', '-U', $dbname4 ],
$node->connstr($dbname2), '-U', $dbname3], 'pg_dumpall with long ASCII name 1');
'pg_dumpall with long ASCII name 2'); $node->command_ok(
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname', [ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
$node->connstr($dbname3), '-U', $dbname2], $node->connstr($dbname2),
'pg_dumpall with long ASCII name 3'); '-U', $dbname3 ],
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname', 'pg_dumpall with long ASCII name 2');
$node->connstr($dbname4), '-U', $dbname1], $node->command_ok(
'pg_dumpall with long ASCII name 4'); [ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
$node->command_ok(['pg_dumpall', '-r', '-l', 'dbname=template1'], $node->connstr($dbname3),
'pg_dumpall -l accepts connection string'); '-U', $dbname2 ],
'pg_dumpall with long ASCII name 3');
$node->run_log(['createdb', "foo\n\rbar"]); $node->command_ok(
[ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
$node->connstr($dbname4),
'-U', $dbname1 ],
'pg_dumpall with long ASCII name 4');
$node->command_ok(
[ 'pg_dumpall', '-r', '-l', 'dbname=template1' ],
'pg_dumpall -l accepts connection string');
$node->run_log([ 'createdb', "foo\n\rbar" ]);
# not sufficient to use -r here # not sufficient to use -r here
$node->command_fails(['pg_dumpall', '-f', $discard], $node->command_fails(
'pg_dumpall with \n\r in database name'); [ 'pg_dumpall', '-f', $discard ],
$node->run_log(['dropdb', "foo\n\rbar"]); 'pg_dumpall with \n\r in database name');
$node->run_log([ 'dropdb', "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()');
# XXX no printed message when this fails, just SIGPIPE termination # XXX no printed message when this fails, just SIGPIPE termination
$node->command_ok(['pg_dump', '-Fd', '-j2', '-f', $dirfmt, $node->command_ok(
'-U', $dbname1, $node->connstr($dbname1)], [ 'pg_dump', '-Fd', '-j2', '-f', $dirfmt,
'parallel dump'); '-U', $dbname1, $node->connstr($dbname1) ],
'parallel dump');
# recreate $dbname1 for restore test # recreate $dbname1 for restore test
$node->run_log(['dropdb', $dbname1]); $node->run_log([ 'dropdb', $dbname1 ]);
$node->run_log(['createdb', $dbname1]); $node->run_log([ 'createdb', $dbname1 ]);
$node->command_ok(['pg_restore', '-v', '-d', 'template1', '-j2', $node->command_ok(
'-U', $dbname1, $dirfmt], [ 'pg_restore', '-v', '-d', 'template1', '-j2', '-U', $dbname1, $dirfmt ],
'parallel restore'); 'parallel restore');
$node->run_log(['dropdb', $dbname1]); $node->run_log([ 'dropdb', $dbname1 ]);
$node->command_ok(['pg_restore', '-C', '-v', '-d', 'template1', '-j2', $node->command_ok(
'-U', $dbname1, $dirfmt], [ 'pg_restore', '-C', '-v', '-d',
'parallel restore with create'); 'template1', '-j2', '-U', $dbname1,
$dirfmt ],
'parallel restore with create');
$node->command_ok(['pg_dumpall', '-f', $plain, '-U', $dbname1], $node->command_ok([ 'pg_dumpall', '-f', $plain, '-U', $dbname1 ],
'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 $bootstrap_super = 'boot';
my $restore_super = qq{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(extra => ['-U', $bootstrap_super, $envar_node->init(
'--locale=C', '--encoding=LATIN1']); extra => [ '-U', $bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
$envar_node->run_log([$ENV{PG_REGRESS}, $envar_node->run_log(
'--config-auth', $envar_node->data_dir, [ $ENV{PG_REGRESS}, '--config-auth',
'--create-role', "$bootstrap_super,$restore_super"]); $envar_node->data_dir, '--create-role',
"$bootstrap_super,$restore_super" ]);
$envar_node->start; $envar_node->start;
# make superuser for restore # make superuser for restore
$envar_node->run_log(['createuser', '-U', $bootstrap_super, '-s', $restore_super]); $envar_node->run_log(
[ 'createuser', '-U', $bootstrap_super, '-s', $restore_super ]);
{ {
local $ENV{PGPORT} = $envar_node->port; local $ENV{PGPORT} = $envar_node->port;
local $ENV{PGUSER} = $restore_super; local $ENV{PGUSER} = $restore_super;
$result = run_log(['psql', '-X', '-f', $plain], '2>', \$stderr); $result = run_log([ 'psql', '-X', '-f', $plain ], '2>', \$stderr);
} }
ok($result, 'restore full dump using environment variables for connection parameters'); ok($result,
'restore full dump using environment variables for connection parameters'
);
is($stderr, '', 'no dump errors'); is($stderr, '', 'no dump errors');
...@@ -126,17 +151,25 @@ is($stderr, '', 'no dump errors'); ...@@ -126,17 +151,25 @@ is($stderr, '', 'no dump errors');
# dbname/user connection parameters. "\connect dbname=" forgets # dbname/user connection parameters. "\connect dbname=" forgets
# user/port from command line. # user/port from command line.
$restore_super =~ s/"//g if $TestLib::windows_os; # IPC::Run mishandles '"' on Windows $restore_super =~ s/"//g
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(extra => ['-U', $bootstrap_super, $cmdline_node->init(
'--locale=C', '--encoding=LATIN1']); extra => [ '-U', $bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
$cmdline_node->run_log([$ENV{PG_REGRESS}, $cmdline_node->run_log(
'--config-auth', $cmdline_node->data_dir, [ $ENV{PG_REGRESS}, '--config-auth',
'--create-role', "$bootstrap_super,$restore_super"]); $cmdline_node->data_dir, '--create-role',
"$bootstrap_super,$restore_super" ]);
$cmdline_node->start; $cmdline_node->start;
$cmdline_node->run_log(['createuser', '-U', $bootstrap_super, '-s', $restore_super]); $cmdline_node->run_log(
[ 'createuser', '-U', $bootstrap_super, '-s', $restore_super ]);
{ {
$result = run_log(['psql', '-p', $cmdline_node->port, '-U', $restore_super, '-X', '-f', $plain], '2>', \$stderr); $result = run_log(
[ 'psql', '-p', $cmdline_node->port, '-U',
$restore_super, '-X', '-f', $plain ],
'2>',
\$stderr);
} }
ok($result, 'restore full dump with command-line options for connection parameters'); ok($result,
'restore full dump with command-line options for connection parameters');
is($stderr, '', 'no dump errors'); is($stderr, '', 'no dump errors');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment