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 58da833. No functional changes here, just whitespace and changing runs from "-f" to "--file=", and similar.
This commit is contained in:
parent
58da833430
commit
6af8b89adb
@ -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' ],
|
||||||
@ -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 = (
|
|||||||
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,34 +47,34 @@ 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', ], },
|
||||||
@ -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', ],
|
|
||||||
restore_cmd => [
|
|
||||||
'pg_restore', '-f',
|
|
||||||
"$tempdir/defaults_parallel.sql", "$tempdir/defaults_parallel", ],
|
|
||||||
},
|
|
||||||
defaults_tar_format => {
|
|
||||||
test_key => 'defaults',
|
|
||||||
dump_cmd => [
|
|
||||||
'pg_dump', '-Ft', '-f', "$tempdir/defaults_tar_format.tar",
|
|
||||||
'postgres', ],
|
'postgres', ],
|
||||||
restore_cmd => [
|
restore_cmd => [
|
||||||
'pg_restore',
|
'pg_restore',
|
||||||
'-Ft', '-f',
|
"--file=$tempdir/defaults_parallel.sql",
|
||||||
"$tempdir/defaults_tar_format.sql",
|
"$tempdir/defaults_parallel", ], },
|
||||||
|
defaults_tar_format => {
|
||||||
|
test_key => 'defaults',
|
||||||
|
dump_cmd => [
|
||||||
|
'pg_dump', '-Ft',
|
||||||
|
"--file=$tempdir/defaults_tar_format.tar", 'postgres', ],
|
||||||
|
restore_cmd => [
|
||||||
|
'pg_restore', '-Ft',
|
||||||
|
"--file=$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.
|
||||||
@ -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
|
||||||
@ -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 = (
|
|||||||
|
|
||||||
'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 = (
|
|||||||
|
|
||||||
'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,
|
||||||
@ -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,
|
||||||
@ -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 = (
|
|||||||
|
|
||||||
'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,
|
||||||
@ -652,7 +662,8 @@ my %tests = (
|
|||||||
'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,
|
||||||
@ -668,8 +679,7 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -680,9 +690,7 @@ my %tests = (
|
|||||||
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/^
|
||||||
@ -705,8 +713,7 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -717,9 +724,7 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -1110,8 +1115,10 @@ 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,
|
||||||
@ -1126,8 +1133,7 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -1885,8 +1891,10 @@ 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,
|
||||||
@ -1901,8 +1909,7 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -2247,7 +2254,8 @@ my %tests = (
|
|||||||
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,
|
||||||
@ -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'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,21 +16,27 @@ $ENV{PGCLIENTENCODING} = '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;
|
||||||
@ -47,32 +53,45 @@ foreach my $dbname ($dbname1, $dbname2, $dbname3, $dbname4, 'CamelCase')
|
|||||||
|
|
||||||
# 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',
|
||||||
|
$node->connstr($dbname1),
|
||||||
|
'-U', $dbname4 ],
|
||||||
'pg_dumpall with long ASCII name 1');
|
'pg_dumpall with long ASCII name 1');
|
||||||
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname',
|
$node->command_ok(
|
||||||
$node->connstr($dbname2), '-U', $dbname3],
|
[ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
|
||||||
|
$node->connstr($dbname2),
|
||||||
|
'-U', $dbname3 ],
|
||||||
'pg_dumpall with long ASCII name 2');
|
'pg_dumpall with long ASCII name 2');
|
||||||
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname',
|
$node->command_ok(
|
||||||
$node->connstr($dbname3), '-U', $dbname2],
|
[ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
|
||||||
|
$node->connstr($dbname3),
|
||||||
|
'-U', $dbname2 ],
|
||||||
'pg_dumpall with long ASCII name 3');
|
'pg_dumpall with long ASCII name 3');
|
||||||
$node->command_ok(['pg_dumpall', '-r', '-f', $discard, '--dbname',
|
$node->command_ok(
|
||||||
$node->connstr($dbname4), '-U', $dbname1],
|
[ 'pg_dumpall', '-r', '-f', $discard, '--dbname',
|
||||||
|
$node->connstr($dbname4),
|
||||||
|
'-U', $dbname1 ],
|
||||||
'pg_dumpall with long ASCII name 4');
|
'pg_dumpall with long ASCII name 4');
|
||||||
$node->command_ok(['pg_dumpall', '-r', '-l', 'dbname=template1'],
|
$node->command_ok(
|
||||||
|
[ 'pg_dumpall', '-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', "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', '-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', "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(
|
||||||
|
[ 'pg_dump', '-Fd', '-j2', '-f', $dirfmt,
|
||||||
'-U', $dbname1, $node->connstr($dbname1) ],
|
'-U', $dbname1, $node->connstr($dbname1) ],
|
||||||
'parallel dump');
|
'parallel dump');
|
||||||
|
|
||||||
@ -80,14 +99,16 @@ $node->command_ok(['pg_dump', '-Fd', '-j2', '-f', $dirfmt,
|
|||||||
$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',
|
||||||
|
'template1', '-j2', '-U', $dbname1,
|
||||||
|
$dirfmt ],
|
||||||
'parallel restore with create');
|
'parallel restore with create');
|
||||||
|
|
||||||
|
|
||||||
@ -103,22 +124,26 @@ my $restore_super = qq{a'b\\c=d\\ne"f};
|
|||||||
# 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');
|
|||||||
# 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');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user