perltidy: Add option --nooutdent-long-quotes

This commit is contained in:
Peter Eisentraut 2018-04-26 11:52:52 -04:00
parent a2ada08d4c
commit d4f16d5071
64 changed files with 294 additions and 287 deletions

View File

@ -16,7 +16,7 @@ sub test_index_replay
# Wait for standby to catch up # Wait for standby to catch up
my $applname = $node_standby->name; my $applname = $node_standby->name;
my $caughtup_query = my $caughtup_query =
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';"; "SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
$node_master->poll_query_until('postgres', $caughtup_query) $node_master->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby 1 to catch up"; or die "Timed out while waiting for standby 1 to catch up";
@ -57,7 +57,7 @@ $node_standby->start;
$node_master->safe_psql("postgres", "CREATE EXTENSION bloom;"); $node_master->safe_psql("postgres", "CREATE EXTENSION bloom;");
$node_master->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);"); $node_master->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);");
$node_master->safe_psql("postgres", $node_master->safe_psql("postgres",
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;" "INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;"
); );
$node_master->safe_psql("postgres", $node_master->safe_psql("postgres",
"CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);"); "CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);");
@ -74,7 +74,7 @@ for my $i (1 .. 10)
test_index_replay("vacuum $i"); test_index_replay("vacuum $i");
my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000); my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000);
$node_master->safe_psql("postgres", $node_master->safe_psql("postgres",
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;" "INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;"
); );
test_index_replay("insert $i"); test_index_replay("insert $i");
} }

View File

@ -177,14 +177,14 @@ kwlist_line: while (<$kwlist>)
if ($kwstring !~ /^[a-z_]+$/) if ($kwstring !~ /^[a-z_]+$/)
{ {
error error
"'$kwstring' is not a valid keyword string, must be all lower-case ASCII chars"; "'$kwstring' is not a valid keyword string, must be all lower-case ASCII chars";
} }
# Check that the keyword name is valid: all upper-case ASCII chars # Check that the keyword name is valid: all upper-case ASCII chars
if ($kwname !~ /^[A-Z_]+$/) if ($kwname !~ /^[A-Z_]+$/)
{ {
error error
"'$kwname' is not a valid keyword name, must be all upper-case ASCII chars"; "'$kwname' is not a valid keyword name, must be all upper-case ASCII chars";
} }
# Check that the keyword string matches keyword name # Check that the keyword string matches keyword name
@ -193,7 +193,7 @@ kwlist_line: while (<$kwlist>)
if ($bare_kwname ne uc($kwstring)) if ($bare_kwname ne uc($kwstring))
{ {
error error
"keyword name '$kwname' doesn't match keyword string '$kwstring'"; "keyword name '$kwname' doesn't match keyword string '$kwstring'";
} }
# Check that the keyword is present in the grammar # Check that the keyword is present in the grammar

View File

@ -18,7 +18,7 @@ open my $h, '>', $htmp or die "Could not open $htmp: $!";
open my $c, '>', $ctmp or die "Could not open $ctmp: $!"; open my $c, '>', $ctmp or die "Could not open $ctmp: $!";
my $autogen = my $autogen =
"/* autogenerated from src/backend/storage/lmgr/lwlocknames.txt, do not edit */\n"; "/* autogenerated from src/backend/storage/lmgr/lwlocknames.txt, do not edit */\n";
print $h $autogen; print $h $autogen;
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n"; print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
print $c $autogen, "\n"; print $c $autogen, "\n";

View File

@ -100,35 +100,35 @@ sub Run()
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4)/ # s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4)/
{ {
$s = $s =
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4)/s; s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4)/s;
$CondReg ||= $s; $CondReg ||= $s;
} }
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5)/ # s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5)/
{ {
$s = $s =
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5)/s; s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5)/s;
$CondReg ||= $s; $CondReg ||= $s;
} }
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/ # s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6)/
{ {
$s = $s =
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6)/s; s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6)/s;
$CondReg ||= $s; $CondReg ||= $s;
} }
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/ # s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/
{ {
$s = $s =
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/s; s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7)/s;
$CondReg ||= $s; $CondReg ||= $s;
} }
# s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/ # s/([^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\}, [^,)]\{1,\})/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/
{ {
$s = $s =
s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/s; s /\([^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+, [^,)]+\)/(INT1, INT2, INT3, INT4, INT5, INT6, INT7, INT8)/s;
$CondReg ||= $s; $CondReg ||= $s;
} }

View File

@ -120,7 +120,7 @@ open my $tfh, '>', $tabfile . $tmpext
or die "Could not open $tabfile$tmpext: $!"; or die "Could not open $tabfile$tmpext: $!";
print $ofh print $ofh
qq|/*------------------------------------------------------------------------- qq|/*-------------------------------------------------------------------------
* *
* fmgroids.h * fmgroids.h
* Macros that define the OIDs of built-in functions. * Macros that define the OIDs of built-in functions.
@ -157,7 +157,7 @@ qq|/*-------------------------------------------------------------------------
|; |;
print $pfh print $pfh
qq|/*------------------------------------------------------------------------- qq|/*-------------------------------------------------------------------------
* *
* fmgrprotos.h * fmgrprotos.h
* Prototypes for built-in functions. * Prototypes for built-in functions.
@ -183,7 +183,7 @@ qq|/*-------------------------------------------------------------------------
|; |;
print $tfh print $tfh
qq|/*------------------------------------------------------------------------- qq|/*-------------------------------------------------------------------------
* *
* fmgrtab.c * fmgrtab.c
* The function manager's table of internal functions. * The function manager's table of internal functions.
@ -230,7 +230,7 @@ my $fmgr_count = 0;
foreach my $s (sort { $a->{oid} <=> $b->{oid} } @fmgr) foreach my $s (sort { $a->{oid} <=> $b->{oid} } @fmgr)
{ {
print $tfh print $tfh
" { $s->{oid}, \"$s->{prosrc}\", $s->{nargs}, $bmap{$s->{strict}}, $bmap{$s->{retset}}, $s->{prosrc} }"; " { $s->{oid}, \"$s->{prosrc}\", $s->{nargs}, $bmap{$s->{strict}}, $bmap{$s->{retset}}, $s->{prosrc} }";
$fmgr_builtin_oid_index[ $s->{oid} ] = $fmgr_count++; $fmgr_builtin_oid_index[ $s->{oid} ] = $fmgr_count++;

View File

@ -168,7 +168,7 @@ sub print_from_utf8_combined_map
printf $out "\n/* Combined character map */\n"; printf $out "\n/* Combined character map */\n";
printf $out printf $out
"static const pg_utf_to_local_combined ULmap${charset}_combined[ %d ] = {", "static const pg_utf_to_local_combined ULmap${charset}_combined[ %d ] = {",
scalar(@$table); scalar(@$table);
my $first = 1; my $first = 1;
foreach my $i (sort { $a->{utf8} <=> $b->{utf8} } @$table) foreach my $i (sort { $a->{utf8} <=> $b->{utf8} } @$table)
@ -202,7 +202,7 @@ sub print_to_utf8_combined_map
printf $out "\n/* Combined character map */\n"; printf $out "\n/* Combined character map */\n";
printf $out printf $out
"static const pg_local_to_utf_combined LUmap${charset}_combined[ %d ] = {", "static const pg_local_to_utf_combined LUmap${charset}_combined[ %d ] = {",
scalar(@$table); scalar(@$table);
my $first = 1; my $first = 1;
@ -613,7 +613,7 @@ sub print_radix_table
if ($seg->{overlaid_trail_zeros}) if ($seg->{overlaid_trail_zeros})
{ {
printf $out printf $out
" /* $seg->{overlaid_trail_zeros} trailing zero values shared with next segment */\n"; " /* $seg->{overlaid_trail_zeros} trailing zero values shared with next segment */\n";
} }
} }
@ -728,7 +728,7 @@ sub make_charmap
if (defined $charmap{$src}) if (defined $charmap{$src})
{ {
printf STDERR printf STDERR
"Error: duplicate source code on %s:%d: 0x%04x => 0x%04x, 0x%04x\n", "Error: duplicate source code on %s:%d: 0x%04x => 0x%04x, 0x%04x\n",
$c->{f}, $c->{l}, $src, $charmap{$src}, $dst; $c->{f}, $c->{l}, $src, $charmap{$src}, $dst;
exit; exit;
} }

View File

@ -420,13 +420,15 @@ rmtree("$tempdir/backupxs_slot");
is( $node->safe_psql( is( $node->safe_psql(
'postgres', 'postgres',
q{SELECT slot_name FROM pg_replication_slots WHERE slot_name = 'slot0'}), q{SELECT slot_name FROM pg_replication_slots WHERE slot_name = 'slot0'}
),
'slot0', 'slot0',
'replication slot was created'); 'replication slot was created');
isnt( isnt(
$node->safe_psql( $node->safe_psql(
'postgres', 'postgres',
q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot0'}), q{SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'slot0'}
),
'', '',
'restart LSN of new slot is not null'); 'restart LSN of new slot is not null');
@ -468,10 +470,10 @@ rmtree("$tempdir/backupxs_sl_R");
# create tables to corrupt and get their relfilenodes # create tables to corrupt and get their relfilenodes
my $file_corrupt1 = $node->safe_psql('postgres', my $file_corrupt1 = $node->safe_psql('postgres',
q{SELECT a INTO corrupt1 FROM generate_series(1,10000) AS a; ALTER TABLE corrupt1 SET (autovacuum_enabled=false); SELECT pg_relation_filepath('corrupt1')} q{SELECT a INTO corrupt1 FROM generate_series(1,10000) AS a; ALTER TABLE corrupt1 SET (autovacuum_enabled=false); SELECT pg_relation_filepath('corrupt1')}
); );
my $file_corrupt2 = $node->safe_psql('postgres', my $file_corrupt2 = $node->safe_psql('postgres',
q{SELECT b INTO corrupt2 FROM generate_series(1,2) AS b; ALTER TABLE corrupt2 SET (autovacuum_enabled=false); SELECT pg_relation_filepath('corrupt2')} q{SELECT b INTO corrupt2 FROM generate_series(1,2) AS b; ALTER TABLE corrupt2 SET (autovacuum_enabled=false); SELECT pg_relation_filepath('corrupt2')}
); );
# set page header and block sizes # set page header and block sizes

View File

@ -33,8 +33,7 @@ close $fh;
command_checks_all( command_checks_all(
[ 'pg_controldata', $node->data_dir ], [ 'pg_controldata', $node->data_dir ],
0, 0,
[ [ qr/WARNING: Calculated CRC checksum does not match value stored in file/,
qr/WARNING: Calculated CRC checksum does not match value stored in file/,
qr/WARNING: invalid WAL segment size/ ], qr/WARNING: invalid WAL segment size/ ],
[qr/^$/], [qr/^$/],
'pg_controldata with corrupted pg_control'); 'pg_controldata with corrupted pg_control');

View File

@ -45,35 +45,36 @@ command_fails_like(
command_fails_like( command_fails_like(
[ 'pg_dump', '-s', '-a' ], [ 'pg_dump', '-s', '-a' ],
qr/\Qpg_dump: options -s\/--schema-only and -a\/--data-only cannot be used together\E/, qr/\Qpg_dump: options -s\/--schema-only and -a\/--data-only cannot be used together\E/,
'pg_dump: options -s/--schema-only and -a/--data-only cannot be used together' 'pg_dump: options -s/--schema-only and -a/--data-only cannot be used together'
); );
command_fails_like( command_fails_like(
[ 'pg_restore', '-s', '-a' ], [ 'pg_restore', '-s', '-a' ],
qr/\Qpg_restore: options -s\/--schema-only and -a\/--data-only cannot be used together\E/, qr/\Qpg_restore: options -s\/--schema-only and -a\/--data-only cannot be used together\E/,
'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_fails_like( command_fails_like(
[ 'pg_restore', '-d', 'xxx', '-f', 'xxx' ], [ 'pg_restore', '-d', 'xxx', '-f', 'xxx' ],
qr/\Qpg_restore: options -d\/--dbname and -f\/--file cannot be used together\E/, qr/\Qpg_restore: options -d\/--dbname and -f\/--file cannot be used together\E/,
'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_fails_like( command_fails_like(
[ 'pg_dump', '-c', '-a' ], [ 'pg_dump', '-c', '-a' ],
qr/\Qpg_dump: options -c\/--clean and -a\/--data-only cannot be used together\E/, qr/\Qpg_dump: options -c\/--clean and -a\/--data-only cannot be used together\E/,
'pg_dump: options -c/--clean and -a/--data-only cannot be used together'); 'pg_dump: options -c/--clean and -a/--data-only cannot be used together');
command_fails_like( command_fails_like(
[ 'pg_restore', '-c', '-a' ], [ 'pg_restore', '-c', '-a' ],
qr/\Qpg_restore: options -c\/--clean and -a\/--data-only cannot be used together\E/, qr/\Qpg_restore: options -c\/--clean and -a\/--data-only cannot be used together\E/,
'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_fails_like( command_fails_like(
[ 'pg_dump', '--inserts', '-o' ], [ 'pg_dump', '--inserts', '-o' ],
qr/\Qpg_dump: options --inserts\/--column-inserts and -o\/--oids cannot be used together\E/, qr/\Qpg_dump: options --inserts\/--column-inserts and -o\/--oids cannot be used together\E/,
'pg_dump: options --inserts/--column-inserts and -o/--oids cannot be used together' 'pg_dump: options --inserts/--column-inserts and -o/--oids cannot be used together'
); );
command_fails_like( command_fails_like(
@ -103,7 +104,7 @@ command_fails_like(
command_fails_like( command_fails_like(
[ 'pg_restore', '--single-transaction', '-j3' ], [ 'pg_restore', '--single-transaction', '-j3' ],
qr/\Qpg_restore: cannot specify both --single-transaction and multiple jobs\E/, qr/\Qpg_restore: cannot specify both --single-transaction and multiple jobs\E/,
'pg_restore: cannot specify both --single-transaction and multiple jobs'); 'pg_restore: cannot specify both --single-transaction and multiple jobs');
command_fails_like( command_fails_like(
@ -124,20 +125,20 @@ command_fails_like(
# pg_dumpall command-line argument checks # pg_dumpall command-line argument checks
command_fails_like( command_fails_like(
[ 'pg_dumpall', '-g', '-r' ], [ 'pg_dumpall', '-g', '-r' ],
qr/\Qpg_dumpall: options -g\/--globals-only and -r\/--roles-only cannot be used together\E/, qr/\Qpg_dumpall: options -g\/--globals-only and -r\/--roles-only cannot be used together\E/,
'pg_dumpall: options -g/--globals-only and -r/--roles-only cannot be used together' 'pg_dumpall: options -g/--globals-only and -r/--roles-only cannot be used together'
); );
command_fails_like( command_fails_like(
[ 'pg_dumpall', '-g', '-t' ], [ 'pg_dumpall', '-g', '-t' ],
qr/\Qpg_dumpall: options -g\/--globals-only and -t\/--tablespaces-only cannot be used together\E/, qr/\Qpg_dumpall: options -g\/--globals-only and -t\/--tablespaces-only cannot be used together\E/,
'pg_dumpall: options -g/--globals-only and -t/--tablespaces-only cannot be used together' 'pg_dumpall: options -g/--globals-only and -t/--tablespaces-only cannot be used together'
); );
command_fails_like( command_fails_like(
[ 'pg_dumpall', '-r', '-t' ], [ 'pg_dumpall', '-r', '-t' ],
qr/\Qpg_dumpall: options -r\/--roles-only and -t\/--tablespaces-only cannot be used together\E/, qr/\Qpg_dumpall: options -r\/--roles-only and -t\/--tablespaces-only cannot be used together\E/,
'pg_dumpall: options -r/--roles-only and -t/--tablespaces-only cannot be used together' 'pg_dumpall: options -r/--roles-only and -t/--tablespaces-only cannot be used together'
); );
command_fails_like( command_fails_like(

View File

@ -533,7 +533,7 @@ my %tests = (
'ALTER TABLE ONLY test_table ALTER COLUMN col1 SET STATISTICS 90' => { 'ALTER TABLE ONLY test_table ALTER COLUMN col1 SET STATISTICS 90' => {
create_order => 93, create_order => 93,
create_sql => create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;', 'ALTER TABLE dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col1 SET STATISTICS 90;\E\n
/xm, /xm,
@ -549,7 +549,7 @@ my %tests = (
'ALTER TABLE ONLY test_table ALTER COLUMN col2 SET STORAGE' => { 'ALTER TABLE ONLY test_table ALTER COLUMN col2 SET STORAGE' => {
create_order => 94, create_order => 94,
create_sql => create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;', 'ALTER TABLE dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col2 SET STORAGE EXTERNAL;\E\n
/xm, /xm,
@ -565,7 +565,7 @@ my %tests = (
'ALTER TABLE ONLY test_table ALTER COLUMN col3 SET STORAGE' => { 'ALTER TABLE ONLY test_table ALTER COLUMN col3 SET STORAGE' => {
create_order => 95, create_order => 95,
create_sql => create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;', 'ALTER TABLE dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col3 SET STORAGE MAIN;\E\n
/xm, /xm,
@ -581,7 +581,7 @@ my %tests = (
'ALTER TABLE ONLY test_table ALTER COLUMN col4 SET n_distinct' => { 'ALTER TABLE ONLY test_table ALTER COLUMN col4 SET n_distinct' => {
create_order => 95, create_order => 95,
create_sql => create_sql =>
'ALTER TABLE dump_test.test_table ALTER COLUMN col4 SET (n_distinct = 10);', 'ALTER TABLE dump_test.test_table ALTER COLUMN col4 SET (n_distinct = 10);',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n \QALTER TABLE ONLY dump_test.test_table ALTER COLUMN col4 SET (n_distinct=10);\E\n
/xm, /xm,
@ -594,7 +594,7 @@ my %tests = (
exclude_dump_test_schema => 1, exclude_dump_test_schema => 1,
exclude_test_table => 1, }, }, exclude_test_table => 1, }, },
'ALTER TABLE ONLY dump_test.measurement ATTACH PARTITION measurement_y2006m2' 'ALTER TABLE ONLY dump_test.measurement ATTACH PARTITION measurement_y2006m2'
=> { => {
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION dump_test_second_schema.measurement_y2006m2 \E \QALTER TABLE ONLY dump_test.measurement ATTACH PARTITION dump_test_second_schema.measurement_y2006m2 \E
@ -674,7 +674,7 @@ my %tests = (
'ALTER TABLE test_third_table OWNER TO' => { 'ALTER TABLE test_third_table OWNER TO' => {
regexp => regexp =>
qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m, qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
@ -691,7 +691,7 @@ qr/^ALTER TABLE dump_test_second_schema.test_third_table OWNER TO .*;/m,
'ALTER TABLE measurement_y2006m2 OWNER TO' => { 'ALTER TABLE measurement_y2006m2 OWNER TO' => {
regexp => regexp =>
qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m, qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
@ -709,7 +709,7 @@ qr/^ALTER TABLE dump_test_second_schema.measurement_y2006m2 OWNER TO .*;/m,
'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => { 'ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 OWNER TO' => {
regexp => regexp =>
qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m, qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
@ -718,7 +718,7 @@ qr/^ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 OWNER TO .*;/m,
'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => { 'ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 OWNER TO' => {
regexp => regexp =>
qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m, qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
@ -730,7 +730,7 @@ qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m,
'BLOB create (using lo_from_bytea)' => { 'BLOB create (using lo_from_bytea)' => {
create_order => 50, create_order => 50,
create_sql => create_sql =>
'SELECT pg_catalog.lo_from_bytea(0, \'\\x310a320a330a340a350a360a370a380a390a\');', '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 => {
%full_runs, %full_runs,
@ -841,7 +841,7 @@ qr/^ALTER TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 OWNER TO .*;/m,
create_sql => 'COMMENT ON CONVERSION dump_test.test_conversion create_sql => 'COMMENT ON CONVERSION dump_test.test_conversion
IS \'comment on test conversion\';', IS \'comment on test conversion\';',
regexp => regexp =>
qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';/m, qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -851,7 +851,7 @@ qr/^COMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversi
create_sql => 'COMMENT ON COLLATION test0 create_sql => 'COMMENT ON COLLATION test0
IS \'comment on test0 collation\';', IS \'comment on test0 collation\';',
regexp => regexp =>
qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m, qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m,
collation => 1, collation => 1,
like => { %full_runs, section_pre_data => 1, }, }, like => { %full_runs, section_pre_data => 1, }, },
@ -899,7 +899,7 @@ qr/^COMMENT ON COLLATION public.test0 IS 'comment on test0 collation';/m,
'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 'COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1
IS \'comment on text search configuration\';', IS \'comment on text search configuration\';',
regexp => regexp =>
qr/^COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';/m, qr/^COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -910,7 +910,7 @@ qr/^COMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on t
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1
IS \'comment on text search dictionary\';', IS \'comment on text search dictionary\';',
regexp => regexp =>
qr/^COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';/m, qr/^COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -920,7 +920,7 @@ qr/^COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text
create_sql => 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 create_sql => 'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1
IS \'comment on text search parser\';', IS \'comment on text search parser\';',
regexp => regexp =>
qr/^COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';/m, qr/^COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -930,7 +930,7 @@ qr/^COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text sear
create_sql => 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 create_sql => 'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1
IS \'comment on text search template\';', IS \'comment on text search template\';',
regexp => regexp =>
qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';/m, qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -950,7 +950,7 @@ qr/^COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text s
create_sql => 'COMMENT ON TYPE dump_test.textrange create_sql => 'COMMENT ON TYPE dump_test.textrange
IS \'comment on range type\';', IS \'comment on range type\';',
regexp => regexp =>
qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m, qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -970,7 +970,7 @@ qr/^COMMENT ON TYPE dump_test.textrange IS 'comment on range type';/m,
create_sql => 'COMMENT ON TYPE dump_test.undefined create_sql => 'COMMENT ON TYPE dump_test.undefined
IS \'comment on undefined type\';', IS \'comment on undefined type\';',
regexp => regexp =>
qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m, qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -1095,7 +1095,7 @@ qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m,
'COPY test_fifth_table' => { 'COPY test_fifth_table' => {
create_order => 54, create_order => 54,
create_sql => create_sql =>
'INSERT INTO dump_test.test_fifth_table VALUES (NULL, true, false, \'11001\'::bit(5), \'NaN\');', 'INSERT INTO dump_test.test_fifth_table VALUES (NULL, true, false, \'11001\'::bit(5), \'NaN\');',
regexp => qr/^ regexp => qr/^
\QCOPY dump_test.test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E \QCOPY dump_test.test_fifth_table (col1, col2, col3, col4, col5) FROM stdin;\E
\n\\N\tt\tf\t11001\tNaN\n\\\.\n \n\\N\tt\tf\t11001\tNaN\n\\\.\n
@ -1113,7 +1113,7 @@ qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m,
'COPY test_table_identity' => { 'COPY test_table_identity' => {
create_order => 54, create_order => 54,
create_sql => create_sql =>
'INSERT INTO dump_test.test_table_identity (col2) VALUES (\'test\');', 'INSERT INTO dump_test.test_table_identity (col2) VALUES (\'test\');',
regexp => qr/^ regexp => qr/^
\QCOPY dump_test.test_table_identity (col1, col2) FROM stdin;\E \QCOPY dump_test.test_table_identity (col1, col2) FROM stdin;\E
\n1\ttest\n\\\.\n \n1\ttest\n\\\.\n
@ -1153,12 +1153,12 @@ qr/^COMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';/m,
'INSERT INTO test_fifth_table' => { 'INSERT INTO test_fifth_table' => {
regexp => regexp =>
qr/^\QINSERT INTO dump_test.test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m, qr/^\QINSERT INTO dump_test.test_fifth_table (col1, col2, col3, col4, col5) VALUES (NULL, true, false, B'11001', 'NaN');\E/m,
like => { column_inserts => 1, }, }, like => { column_inserts => 1, }, },
'INSERT INTO test_table_identity' => { 'INSERT INTO test_table_identity' => {
regexp => regexp =>
qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m, qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM VALUE VALUES (1, 'test');\E/m,
like => { column_inserts => 1, }, }, like => { column_inserts => 1, }, },
'CREATE ROLE regress_dump_test_role' => { 'CREATE ROLE regress_dump_test_role' => {
@ -1189,9 +1189,9 @@ qr/^\QINSERT INTO dump_test.test_table_identity (col1, col2) OVERRIDING SYSTEM V
'CREATE CAST FOR timestamptz' => { 'CREATE CAST FOR timestamptz' => {
create_order => 51, create_order => 51,
create_sql => create_sql =>
'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;', 'CREATE CAST (timestamptz AS interval) WITH FUNCTION age(timestamptz) AS ASSIGNMENT;',
regexp => regexp =>
qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m, qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog\.age\(timestamp with time zone\) AS ASSIGNMENT;/m,
like => { %full_runs, section_pre_data => 1, }, }, like => { %full_runs, section_pre_data => 1, }, },
'CREATE DATABASE postgres' => { 'CREATE DATABASE postgres' => {
@ -1244,9 +1244,9 @@ qr/CREATE CAST \(timestamp with time zone AS interval\) WITH FUNCTION pg_catalog
'CREATE CONVERSION dump_test.test_conversion' => { 'CREATE CONVERSION dump_test.test_conversion' => {
create_order => 78, create_order => 78,
create_sql => create_sql =>
'CREATE DEFAULT CONVERSION dump_test.test_conversion FOR \'LATIN1\' TO \'UTF8\' FROM iso8859_1_to_utf8;', 'CREATE DEFAULT CONVERSION dump_test.test_conversion FOR \'LATIN1\' TO \'UTF8\' FROM iso8859_1_to_utf8;',
regexp => regexp =>
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm, qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { exclude_dump_test_schema => 1, }, }, unlike => { exclude_dump_test_schema => 1, }, },
@ -1437,7 +1437,7 @@ qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8'
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => { 'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => {
create_order => 80, create_order => 80,
create_sql => create_sql =>
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (copy=english);', 'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (copy=english);',
regexp => qr/^ regexp => qr/^
\QCREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (\E\n \QCREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 (\E\n
\s+\QPARSER = pg_catalog."default" );\E/xm, \s+\QPARSER = pg_catalog."default" );\E/xm,
@ -1512,7 +1512,7 @@ qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8'
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => { 'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
create_order => 81, create_order => 81,
create_sql => create_sql =>
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (lexize=dsimple_lexize);', 'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (lexize=dsimple_lexize);',
regexp => qr/^ regexp => qr/^
\QCREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (\E\n \QCREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 (\E\n
\s+\QLEXIZE = dsimple_lexize );\E/xm, \s+\QLEXIZE = dsimple_lexize );\E/xm,
@ -1538,7 +1538,7 @@ qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8'
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => { 'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
create_order => 83, create_order => 83,
create_sql => create_sql =>
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (template=simple);', 'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (template=simple);',
regexp => qr/^ regexp => qr/^
\QCREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (\E\n \QCREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 (\E\n
\s+\QTEMPLATE = pg_catalog.simple );\E\n \s+\QTEMPLATE = pg_catalog.simple );\E\n
@ -1650,7 +1650,7 @@ qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8'
'CREATE FOREIGN TABLE dump_test.foreign_table SERVER s1' => { 'CREATE FOREIGN TABLE dump_test.foreign_table SERVER s1' => {
create_order => 88, create_order => 88,
create_sql => create_sql =>
'CREATE FOREIGN TABLE dump_test.foreign_table (c1 int options (column_name \'col1\')) 'CREATE FOREIGN TABLE dump_test.foreign_table (c1 int options (column_name \'col1\'))
SERVER s1 OPTIONS (schema_name \'x1\');', SERVER s1 OPTIONS (schema_name \'x1\');',
regexp => qr/ regexp => qr/
\QCREATE FOREIGN TABLE dump_test.foreign_table (\E\n \QCREATE FOREIGN TABLE dump_test.foreign_table (\E\n
@ -1676,9 +1676,9 @@ qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8'
'CREATE TRANSFORM FOR int' => { 'CREATE TRANSFORM FOR int' => {
create_order => 34, create_order => 34,
create_sql => create_sql =>
'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_transform(internal), TO SQL WITH FUNCTION int4recv(internal));', 'CREATE TRANSFORM FOR int LANGUAGE SQL (FROM SQL WITH FUNCTION varchar_transform(internal), TO SQL WITH FUNCTION int4recv(internal));',
regexp => 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, 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 => { %full_runs, section_pre_data => 1, }, }, like => { %full_runs, section_pre_data => 1, }, },
'CREATE LANGUAGE pltestlang' => { 'CREATE LANGUAGE pltestlang' => {
@ -2215,7 +2215,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
catch_all => 'CREATE ... commands', catch_all => 'CREATE ... commands',
create_order => 93, create_order => 93,
create_sql => create_sql =>
'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);', 'ALTER TABLE dump_test.measurement ADD PRIMARY KEY (city_id, logdate);',
regexp => qr/^ regexp => qr/^
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+ \QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E \QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
@ -2443,7 +2443,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
'GRANT USAGE ON DOMAIN dump_test.us_postal_code' => { 'GRANT USAGE ON DOMAIN dump_test.us_postal_code' => {
create_order => 72, create_order => 72,
create_sql => create_sql =>
'GRANT USAGE ON DOMAIN dump_test.us_postal_code TO regress_dump_test_role;', 'GRANT USAGE ON DOMAIN dump_test.us_postal_code TO regress_dump_test_role;',
regexp => qr/^ regexp => qr/^
\QGRANT ALL ON TYPE dump_test.us_postal_code TO regress_dump_test_role;\E \QGRANT ALL ON TYPE dump_test.us_postal_code TO regress_dump_test_role;\E
/xm, /xm,
@ -2482,7 +2482,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
'GRANT USAGE ON TYPE dump_test.textrange - RANGE' => { 'GRANT USAGE ON TYPE dump_test.textrange - RANGE' => {
create_order => 67, create_order => 67,
create_sql => create_sql =>
'GRANT USAGE ON TYPE dump_test.textrange TO regress_dump_test_role;', 'GRANT USAGE ON TYPE dump_test.textrange TO regress_dump_test_role;',
regexp => qr/^ regexp => qr/^
\QGRANT ALL ON TYPE dump_test.textrange TO regress_dump_test_role;\E \QGRANT ALL ON TYPE dump_test.textrange TO regress_dump_test_role;\E
/xm, /xm,
@ -2506,7 +2506,7 @@ qr/CREATE TRANSFORM FOR integer LANGUAGE sql \(FROM SQL WITH FUNCTION pg_catalog
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;',
regexp => regexp =>
qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m, qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m,
like => { like => {
%full_runs, %full_runs,
%dump_test_schema_runs, %dump_test_schema_runs,
@ -2523,7 +2523,7 @@ qr/^GRANT SELECT ON TABLE dump_test.test_table TO regress_dump_test_role;/m,
TABLE dump_test_second_schema.test_third_table TABLE dump_test_second_schema.test_third_table
TO regress_dump_test_role;', TO regress_dump_test_role;',
regexp => regexp =>
qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_dump_test_role;/m, qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_dump_test_role;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
@ -2550,7 +2550,7 @@ qr/^GRANT SELECT ON TABLE dump_test_second_schema.test_third_table TO regress_du
TABLE dump_test.measurement TABLE dump_test.measurement
TO regress_dump_test_role;', TO regress_dump_test_role;',
regexp => regexp =>
qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m, qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m,
like => like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, }, { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
unlike => { unlike => {
@ -2563,7 +2563,7 @@ qr/^GRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;/m,
TABLE dump_test_second_schema.measurement_y2006m2 TABLE dump_test_second_schema.measurement_y2006m2
TO regress_dump_test_role;', TO regress_dump_test_role;',
regexp => regexp =>
qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress_dump_test_role;/m, qr/^GRANT SELECT ON TABLE dump_test_second_schema.measurement_y2006m2 TO regress_dump_test_role;/m,
like => { like => {
%full_runs, %full_runs,
role => 1, role => 1,
@ -2937,8 +2937,8 @@ foreach my $db (sort keys %create_sql)
command_fails_like( command_fails_like(
[ 'pg_dump', '-p', "$port", 'qqq' ], [ 'pg_dump', '-p', "$port", 'qqq' ],
qr/\Qpg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist\E/, qr/\Qpg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist\E/,
'pg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist' 'pg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: database "qqq" does not exist'
); );
######################################### #########################################
@ -2946,7 +2946,7 @@ qr/\Qpg_dump: [archiver (db)] connection to database "qqq" failed: FATAL: datab
command_fails_like( command_fails_like(
[ 'pg_dump', '-p', "$port", '--role=regress_dump_test_role' ], [ 'pg_dump', '-p', "$port", '--role=regress_dump_test_role' ],
qr/\Qpg_dump: [archiver (db)] query failed: ERROR: permission denied for\E/, qr/\Qpg_dump: [archiver (db)] query failed: ERROR: permission denied for\E/,
'pg_dump: [archiver (db)] query failed: ERROR: permission denied for'); 'pg_dump: [archiver (db)] query failed: ERROR: permission denied for');
######################################### #########################################

View File

@ -31,8 +31,7 @@ command_checks_all(
[ 'pg_resetwal', '-n', $node->data_dir ], [ 'pg_resetwal', '-n', $node->data_dir ],
0, 0,
[qr/pg_control version number/], [qr/pg_control version number/],
[ [ qr/pg_resetwal: pg_control exists but is broken or wrong version; ignoring it/
qr/pg_resetwal: pg_control exists but is broken or wrong version; ignoring it/
], ],
'processes corrupted pg_control all zeroes'); 'processes corrupted pg_control all zeroes');
@ -47,7 +46,6 @@ command_checks_all(
[ 'pg_resetwal', '-n', $node->data_dir ], [ 'pg_resetwal', '-n', $node->data_dir ],
0, 0,
[qr/pg_control version number/], [qr/pg_control version number/],
[ [ qr/\Qpg_resetwal: pg_control specifies invalid WAL segment size (0 bytes); proceed with caution\E/
qr/\Qpg_resetwal: pg_control specifies invalid WAL segment size (0 bytes); proceed with caution\E/
], ],
'processes zero WAL segment size'); 'processes zero WAL segment size');

View File

@ -35,7 +35,7 @@ sub run_test
master_psql( master_psql(
"INSERT INTO trunc_tbl values ('in master, before promotion')"); "INSERT INTO trunc_tbl values ('in master, before promotion')");
master_psql( master_psql(
"INSERT INTO tail_tbl SELECT g, 'in master, before promotion: ' || g FROM generate_series(1, 10000) g" "INSERT INTO tail_tbl SELECT g, 'in master, before promotion: ' || g FROM generate_series(1, 10000) g"
); );
master_psql('CHECKPOINT'); master_psql('CHECKPOINT');
@ -54,7 +54,7 @@ sub run_test
# Insert enough rows to trunc_tbl to extend the file. pg_rewind should # Insert enough rows to trunc_tbl to extend the file. pg_rewind should
# truncate it back to the old size. # truncate it back to the old size.
master_psql( master_psql(
"INSERT INTO trunc_tbl SELECT 'in master, after promotion: ' || g FROM generate_series(1, 10000) g" "INSERT INTO trunc_tbl SELECT 'in master, after promotion: ' || g FROM generate_series(1, 10000) g"
); );
# Truncate tail_tbl. pg_rewind should copy back the truncated part # Truncate tail_tbl. pg_rewind should copy back the truncated part

View File

@ -75,7 +75,8 @@ sub run_test
"$test_master_datadir/tst_standby_dir/standby_file1", "$test_master_datadir/tst_standby_dir/standby_file1",
"$test_master_datadir/tst_standby_dir/standby_file2", "$test_master_datadir/tst_standby_dir/standby_file2",
"$test_master_datadir/tst_standby_dir/standby_subdir", "$test_master_datadir/tst_standby_dir/standby_subdir",
"$test_master_datadir/tst_standby_dir/standby_subdir/standby_file3" ], "$test_master_datadir/tst_standby_dir/standby_subdir/standby_file3"
],
"file lists match"); "file lists match");
RewindTest::clean_rewind_test(); RewindTest::clean_rewind_test();

View File

@ -89,7 +89,7 @@ pgbench(
# Again, with all possible options # Again, with all possible options
pgbench( pgbench(
'--initialize --init-steps=dtpvg --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default', '--initialize --init-steps=dtpvg --scale=1 --unlogged-tables --fillfactor=98 --foreign-keys --quiet --tablespace=pg_default --index-tablespace=pg_default',
0, 0,
[qr{^$}i], [qr{^$}i],
[ qr{dropping old tables}, [ qr{dropping old tables},
@ -102,7 +102,7 @@ pgbench(
# Test interaction of --init-steps with legacy step-selection options # Test interaction of --init-steps with legacy step-selection options
pgbench( pgbench(
'--initialize --init-steps=dtpvgvv --no-vacuum --foreign-keys --unlogged-tables', '--initialize --init-steps=dtpvgvv --no-vacuum --foreign-keys --unlogged-tables',
0, 0,
[qr{^$}], [qr{^$}],
[ qr{dropping old tables}, [ qr{dropping old tables},
@ -126,7 +126,7 @@ pgbench(
'pgbench tpcb-like'); 'pgbench tpcb-like');
pgbench( pgbench(
'--transactions=20 --client=5 -M extended --builtin=si -C --no-vacuum -s 1', '--transactions=20 --client=5 -M extended --builtin=si -C --no-vacuum -s 1',
0, 0,
[ qr{builtin: simple update}, [ qr{builtin: simple update},
qr{clients: 5\b}, qr{clients: 5\b},
@ -221,7 +221,7 @@ COMMIT;
# test expressions # test expressions
# command 1..3 and 23 depend on random seed which is used to call srandom. # command 1..3 and 23 depend on random seed which is used to call srandom.
pgbench( pgbench(
'--random-seed=5432 -t 1 -Dfoo=-10.1 -Dbla=false -Di=+3 -Dminint=-9223372036854775808 -Dn=null -Dt=t -Df=of -Dd=1.0', '--random-seed=5432 -t 1 -Dfoo=-10.1 -Dbla=false -Di=+3 -Dminint=-9223372036854775808 -Dn=null -Dt=t -Df=of -Dd=1.0',
0, 0,
[ qr{type: .*/001_pgbench_expressions}, qr{processed: 1/1} ], [ qr{type: .*/001_pgbench_expressions}, qr{processed: 1/1} ],
[ qr{setting random seed to 5432\b}, [ qr{setting random seed to 5432\b},
@ -415,7 +415,7 @@ SELECT :v0, :v1, :v2, :v3;
# random determinism when seeded # random determinism when seeded
$node->safe_psql('postgres', $node->safe_psql('postgres',
'CREATE UNLOGGED TABLE seeded_random(seed INT8 NOT NULL, rand TEXT NOT NULL, val INTEGER NOT NULL);' 'CREATE UNLOGGED TABLE seeded_random(seed INT8 NOT NULL, rand TEXT NOT NULL, val INTEGER NOT NULL);'
); );
# same value to check for determinism # same value to check for determinism
@ -443,7 +443,7 @@ INSERT INTO seeded_random(seed, rand, val) VALUES
# check that all runs generated the same 4 values # check that all runs generated the same 4 values
my ($ret, $out, $err) = $node->psql('postgres', my ($ret, $out, $err) = $node->psql('postgres',
'SELECT seed, rand, val, COUNT(*) FROM seeded_random GROUP BY seed, rand, val' 'SELECT seed, rand, val, COUNT(*) FROM seeded_random GROUP BY seed, rand, val'
); );
ok($ret == 0, "psql seeded_random count ok"); ok($ret == 0, "psql seeded_random count ok");
@ -627,7 +627,7 @@ for my $e (@errors)
my $n = '001_pgbench_error_' . $name; my $n = '001_pgbench_error_' . $name;
$n =~ s/ /_/g; $n =~ s/ /_/g;
pgbench( pgbench(
'-n -t 1 -Dfoo=bla -Dnull=null -Dtrue=true -Done=1 -Dzero=0.0 -Dbadtrue=trueXXX -M prepared', '-n -t 1 -Dfoo=bla -Dnull=null -Dtrue=true -Done=1 -Dzero=0.0 -Dbadtrue=trueXXX -M prepared',
$status, $status,
[ $status ? qr{^$} : qr{processed: 0/1} ], [ $status ? qr{^$} : qr{processed: 0/1} ],
$re, $re,
@ -710,7 +710,7 @@ my $bdir = $node->basedir;
# with sampling rate # with sampling rate
pgbench( pgbench(
"-n -S -t 50 -c 2 --log --log-prefix=$bdir/001_pgbench_log_2 --sampling-rate=0.5", "-n -S -t 50 -c 2 --log --log-prefix=$bdir/001_pgbench_log_2 --sampling-rate=0.5",
0, 0,
[ qr{select only}, qr{processed: 100/100} ], [ qr{select only}, qr{processed: 100/100} ],
[qr{^$}], [qr{^$}],

View File

@ -114,8 +114,7 @@ my @options = (
[ qr{unrecognized initialization step}, qr{allowed steps are} ] ], [ qr{unrecognized initialization step}, qr{allowed steps are} ] ],
[ 'bad random seed', [ 'bad random seed',
'--random-seed=one', '--random-seed=one',
[ [ qr{unrecognized random seed option "one": expecting an unsigned integer, "time" or "rand"},
qr{unrecognized random seed option "one": expecting an unsigned integer, "time" or "rand"},
qr{error while setting random seed from --random-seed option} ] ], qr{error while setting random seed from --random-seed option} ] ],
# loging sub-options # loging sub-options

View File

@ -22,7 +22,7 @@ $node->command_fails([ 'clusterdb', '-t', 'nonexistent' ],
'fails with nonexistent table'); 'fails with nonexistent table');
$node->safe_psql('postgres', $node->safe_psql('postgres',
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x' 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x'
); );
$node->issues_sql_like( $node->issues_sql_like(
[ 'clusterdb', '-t', 'test1' ], [ 'clusterdb', '-t', 'test1' ],

View File

@ -15,19 +15,19 @@ $node->start;
$node->issues_sql_like( $node->issues_sql_like(
[ 'createuser', 'regress_user1' ], [ 'createuser', 'regress_user1' ],
qr/statement: CREATE ROLE regress_user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/, qr/statement: CREATE ROLE regress_user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
'SQL CREATE USER run'); 'SQL CREATE USER run');
$node->issues_sql_like( $node->issues_sql_like(
[ 'createuser', '-L', 'regress_role1' ], [ 'createuser', '-L', 'regress_role1' ],
qr/statement: CREATE ROLE regress_role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/, qr/statement: CREATE ROLE regress_role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
'create a non-login role'); 'create a non-login role');
$node->issues_sql_like( $node->issues_sql_like(
[ 'createuser', '-r', 'regress_user2' ], [ 'createuser', '-r', 'regress_user2' ],
qr/statement: CREATE ROLE regress_user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/, qr/statement: CREATE ROLE regress_user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
'create a CREATEROLE user'); 'create a CREATEROLE user');
$node->issues_sql_like( $node->issues_sql_like(
[ 'createuser', '-s', 'regress_user3' ], [ 'createuser', '-s', 'regress_user3' ],
qr/statement: CREATE ROLE regress_user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/, qr/statement: CREATE ROLE regress_user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
'create a superuser'); 'create a superuser');
$node->command_fails([ 'createuser', 'regress_user1' ], $node->command_fails([ 'createuser', 'regress_user1' ],

View File

@ -10,7 +10,7 @@ $node->start;
$node->issues_sql_like( $node->issues_sql_like(
[ 'vacuumdb', '--analyze-in-stages', 'postgres' ], [ 'vacuumdb', '--analyze-in-stages', 'postgres' ],
qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0; qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
.*statement:\ ANALYZE.* .*statement:\ ANALYZE.*
.*statement:\ SET\ default_statistics_target=10;\ RESET\ vacuum_cost_delay; .*statement:\ SET\ default_statistics_target=10;\ RESET\ vacuum_cost_delay;
.*statement:\ ANALYZE.* .*statement:\ ANALYZE.*
@ -20,7 +20,7 @@ qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
$node->issues_sql_like( $node->issues_sql_like(
[ 'vacuumdb', '--analyze-in-stages', '--all' ], [ 'vacuumdb', '--analyze-in-stages', '--all' ],
qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0; qr/.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
.*statement:\ ANALYZE.* .*statement:\ ANALYZE.*
.*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0; .*statement:\ SET\ default_statistics_target=1;\ SET\ vacuum_cost_delay=0;
.*statement:\ ANALYZE.* .*statement:\ ANALYZE.*

View File

@ -39,7 +39,7 @@ my %replace_line = (
'ExecuteStmtEXECUTEnameexecute_param_clause' => 'ExecuteStmtEXECUTEnameexecute_param_clause' =>
'EXECUTE prepared_name execute_param_clause execute_rest', 'EXECUTE prepared_name execute_param_clause execute_rest',
'ExecuteStmtCREATEOptTempTABLEcreate_as_targetASEXECUTEnameexecute_param_clause' 'ExecuteStmtCREATEOptTempTABLEcreate_as_targetASEXECUTEnameexecute_param_clause'
=> 'CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause', => 'CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause',
'PrepareStmtPREPAREnameprep_type_clauseASPreparableStmt' => 'PrepareStmtPREPAREnameprep_type_clauseASPreparableStmt' =>

View File

@ -101,7 +101,7 @@ my %replace_line = (
'RETURNING target_list opt_ecpg_into', 'RETURNING target_list opt_ecpg_into',
'ExecuteStmtEXECUTEnameexecute_param_clause' => 'ExecuteStmtEXECUTEnameexecute_param_clause' =>
'EXECUTE prepared_name execute_param_clause execute_rest', 'EXECUTE prepared_name execute_param_clause execute_rest',
'ExecuteStmtCREATEOptTempTABLEcreate_as_targetASEXECUTEnameexecute_param_clause' 'ExecuteStmtCREATEOptTempTABLEcreate_as_targetASEXECUTEnameexecute_param_clause'
=> 'CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause', => 'CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause',
'PrepareStmtPREPAREnameprep_type_clauseASPreparableStmt' => 'PrepareStmtPREPAREnameprep_type_clauseASPreparableStmt' =>
'PREPARE prepared_name prep_type_clause AS PreparableStmt', 'PREPARE prepared_name prep_type_clause AS PreparableStmt',
@ -501,7 +501,7 @@ sub dump_fields
if ($flds->[0] ne 'create' || $flds->[2] ne 'table') if ($flds->[0] ne 'create' || $flds->[2] ne 'table')
{ {
add_to_buffer('rules', add_to_buffer('rules',
'mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");' 'mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to server");'
); );
} }
$feature_not_supported = 0; $feature_not_supported = 0;

View File

@ -57,10 +57,11 @@ $node->start;
# Create 3 roles with different password methods for each one. The same # Create 3 roles with different password methods for each one. The same
# password is used for all of them. # password is used for all of them.
$node->safe_psql('postgres', $node->safe_psql('postgres',
"SET password_encryption='scram-sha-256'; CREATE ROLE scram_role LOGIN PASSWORD 'pass';" "SET password_encryption='scram-sha-256'; CREATE ROLE scram_role LOGIN PASSWORD 'pass';"
); );
$node->safe_psql('postgres', $node->safe_psql('postgres',
"SET password_encryption='md5'; CREATE ROLE md5_role LOGIN PASSWORD 'pass';"); "SET password_encryption='md5'; CREATE ROLE md5_role LOGIN PASSWORD 'pass';"
);
$ENV{"PGPASSWORD"} = 'pass'; $ENV{"PGPASSWORD"} = 'pass';
# For "trust" method, all users should be able to connect. # For "trust" method, all users should be able to connect.

View File

@ -150,7 +150,7 @@ note "simple bind";
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="uid=" ldapsuffix=",dc=example,dc=net"} qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="uid=" ldapsuffix=",dc=example,dc=net"}
); );
$node->restart; $node->restart;
@ -166,7 +166,7 @@ note "search+bind";
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"} qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn"}
); );
$node->restart; $node->restart;
@ -199,7 +199,7 @@ note "search filters";
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"} qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"}
); );
$node->restart; $node->restart;
@ -212,7 +212,7 @@ note "search filters in LDAP URLs";
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub?(|(uid=\$username)(mail=\$username))"} qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub?(|(uid=\$username)(mail=\$username))"}
); );
$node->restart; $node->restart;
@ -226,7 +226,7 @@ test_access($node, 'test2@example.net', 0, 'search filter finds by mail');
# override. It might be useful in a case like this. # override. It might be useful in a case like this.
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"} qq{local all all ldap ldapurl="$ldap_url/$ldap_basedn??sub" ldapsearchfilter="(|(uid=\$username)(mail=\$username))"}
); );
$node->restart; $node->restart;
@ -238,7 +238,7 @@ note "diagnostic message";
# note bad ldapprefix with a question mark that triggers a diagnostic message # note bad ldapprefix with a question mark that triggers a diagnostic message
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="?uid=" ldapsuffix=""} qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapprefix="?uid=" ldapsuffix=""}
); );
$node->restart; $node->restart;
@ -250,7 +250,7 @@ note "TLS";
# request StartTLS with ldaptls=1 # request StartTLS with ldaptls=1
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)" ldaptls=1} qq{local all all ldap ldapserver=$ldap_server ldapport=$ldap_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)" ldaptls=1}
); );
$node->restart; $node->restart;
@ -260,7 +260,7 @@ test_access($node, 'test1', 0, 'StartTLS');
# request LDAPS with ldapscheme=ldaps # request LDAPS with ldapscheme=ldaps
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapserver=$ldap_server ldapscheme=ldaps ldapport=$ldaps_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)"} qq{local all all ldap ldapserver=$ldap_server ldapscheme=ldaps ldapport=$ldaps_port ldapbasedn="$ldap_basedn" ldapsearchfilter="(uid=\$username)"}
); );
$node->restart; $node->restart;
@ -270,7 +270,7 @@ test_access($node, 'test1', 0, 'LDAPS');
# request LDAPS with ldapurl=ldaps://... # request LDAPS with ldapurl=ldaps://...
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)"} qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)"}
); );
$node->restart; $node->restart;
@ -280,7 +280,7 @@ test_access($node, 'test1', 0, 'LDAPS with URL');
# bad combination of LDAPS and StartTLS # bad combination of LDAPS and StartTLS
unlink($node->data_dir . '/pg_hba.conf'); unlink($node->data_dir . '/pg_hba.conf');
$node->append_conf('pg_hba.conf', $node->append_conf('pg_hba.conf',
qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)" ldaptls=1} qq{local all all ldap ldapurl="$ldaps_url/$ldap_basedn??sub?(uid=\$username)" ldaptls=1}
); );
$node->restart; $node->restart;

View File

@ -22,7 +22,7 @@ $node->safe_psql(
' '
); );
my $count = $node->safe_psql('postgres', my $count = $node->safe_psql('postgres',
"select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" "select count(*) from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)"
); );
is($count, '1', "initial index state is correct"); is($count, '1', "initial index state is correct");
@ -31,11 +31,11 @@ $node->safe_psql('postgres',
$node->poll_query_until( $node->poll_query_until(
'postgres', 'postgres',
"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)", "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)",
't'); 't');
$count = $node->safe_psql('postgres', $count = $node->safe_psql('postgres',
"select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)" "select count(*) > 1 from brin_page_items(get_raw_page('brin_wi_idx', 2), 'brin_wi_idx'::regclass)"
); );
is($count, 't', "index got summarized"); is($count, 't', "index got summarized");
$node->stop; $node->stop;

View File

@ -16,11 +16,11 @@ $node->start;
$node->safe_psql('postgres', $node->safe_psql('postgres',
'create table t as select now from (select now(), pg_sleep(1)) f'); 'create table t as select now from (select now(), pg_sleep(1)) f');
my $true = $node->safe_psql('postgres', my $true = $node->safe_psql('postgres',
'select t.now - ts.* < \'1s\' from t, pg_class c, pg_xact_commit_timestamp(c.xmin) ts where relname = \'t\'' 'select t.now - ts.* < \'1s\' from t, pg_class c, pg_xact_commit_timestamp(c.xmin) ts where relname = \'t\''
); );
is($true, 't', 'commit TS is set'); is($true, 't', 'commit TS is set');
my $ts = $node->safe_psql('postgres', my $ts = $node->safe_psql('postgres',
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\'' 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''
); );
# Verify that we read the same TS after crash recovery # Verify that we read the same TS after crash recovery
@ -28,6 +28,6 @@ $node->stop('immediate');
$node->start; $node->start;
my $recovered_ts = $node->safe_psql('postgres', my $recovered_ts = $node->safe_psql('postgres',
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\'' 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''
); );
is($recovered_ts, $ts, 'commit TS remains after crash recovery'); is($recovered_ts, $ts, 'commit TS remains after crash recovery');

View File

@ -28,7 +28,7 @@ for my $i (1 .. 10)
$master->safe_psql('postgres', "create table t$i()"); $master->safe_psql('postgres', "create table t$i()");
} }
my $master_ts = $master->safe_psql('postgres', my $master_ts = $master->safe_psql('postgres',
qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'} qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}
); );
my $master_lsn = my $master_lsn =
$master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $master->safe_psql('postgres', 'select pg_current_wal_lsn()');
@ -37,7 +37,7 @@ $standby->poll_query_until('postgres',
or die "standby never caught up"; or die "standby never caught up";
my $standby_ts = $standby->safe_psql('postgres', my $standby_ts = $standby->safe_psql('postgres',
qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'} qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'}
); );
is($master_ts, $standby_ts, "standby gives same value as master"); is($master_ts, $standby_ts, "standby gives same value as master");
@ -52,7 +52,7 @@ $standby->safe_psql('postgres', 'checkpoint');
# This one should raise an error now # This one should raise an error now
my ($ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres', my ($ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres',
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\'' 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\''
); );
is($ret, 3, 'standby errors when master turned feature off'); is($ret, 3, 'standby errors when master turned feature off');
is($standby_ts_stdout, '', is($standby_ts_stdout, '',

View File

@ -40,7 +40,7 @@ $standby->restart;
my ($psql_ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql( my ($psql_ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql(
'postgres', 'postgres',
qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'} qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}
); );
is($psql_ret, 3, 'expect error when getting commit timestamp after restart'); is($psql_ret, 3, 'expect error when getting commit timestamp after restart');
is($standby_ts_stdout, '', "standby does not return a value after restart"); is($standby_ts_stdout, '', "standby does not return a value after restart");
@ -58,7 +58,7 @@ system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote');
$standby->safe_psql('postgres', "create table t11()"); $standby->safe_psql('postgres', "create table t11()");
my $standby_ts = $standby->safe_psql('postgres', my $standby_ts = $standby->safe_psql('postgres',
qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't11'} qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't11'}
); );
isnt($standby_ts, '', isnt($standby_ts, '',
"standby gives valid value ($standby_ts) after promotion"); "standby gives valid value ($standby_ts) after promotion");

View File

@ -190,7 +190,7 @@ my %tests = (
'ALTER EXTENSION test_pg_dump' => { 'ALTER EXTENSION test_pg_dump' => {
create_order => 9, create_order => 9,
create_sql => create_sql =>
'ALTER EXTENSION test_pg_dump ADD TABLE regress_pg_dump_table_added;', 'ALTER EXTENSION test_pg_dump ADD TABLE regress_pg_dump_table_added;',
regexp => qr/^ regexp => qr/^
\QCREATE TABLE public.regress_pg_dump_table_added (\E \QCREATE TABLE public.regress_pg_dump_table_added (\E
\n\s+\Qcol1 integer NOT NULL,\E \n\s+\Qcol1 integer NOT NULL,\E
@ -231,7 +231,7 @@ my %tests = (
'CREATE TABLE regress_pg_dump_table_added' => { 'CREATE TABLE regress_pg_dump_table_added' => {
create_order => 7, create_order => 7,
create_sql => create_sql =>
'CREATE TABLE regress_pg_dump_table_added (col1 int not null, col2 int);', 'CREATE TABLE regress_pg_dump_table_added (col1 int not null, col2 int);',
regexp => qr/^ regexp => qr/^
\QCREATE TABLE public.regress_pg_dump_table_added (\E \QCREATE TABLE public.regress_pg_dump_table_added (\E
\n\s+\Qcol1 integer NOT NULL,\E \n\s+\Qcol1 integer NOT NULL,\E
@ -288,7 +288,7 @@ my %tests = (
'GRANT SELECT regress_pg_dump_table_added pre-ALTER EXTENSION' => { 'GRANT SELECT regress_pg_dump_table_added pre-ALTER EXTENSION' => {
create_order => 8, create_order => 8,
create_sql => create_sql =>
'GRANT SELECT ON regress_pg_dump_table_added TO regress_dump_test_role;', 'GRANT SELECT ON regress_pg_dump_table_added TO regress_dump_test_role;',
regexp => qr/^ regexp => qr/^
\QGRANT SELECT ON TABLE public.regress_pg_dump_table_added TO regress_dump_test_role;\E \QGRANT SELECT ON TABLE public.regress_pg_dump_table_added TO regress_dump_test_role;\E
\n/xm, \n/xm,
@ -297,7 +297,7 @@ my %tests = (
'REVOKE SELECT regress_pg_dump_table_added post-ALTER EXTENSION' => { 'REVOKE SELECT regress_pg_dump_table_added post-ALTER EXTENSION' => {
create_order => 10, create_order => 10,
create_sql => create_sql =>
'REVOKE SELECT ON regress_pg_dump_table_added FROM regress_dump_test_role;', 'REVOKE SELECT ON regress_pg_dump_table_added FROM regress_dump_test_role;',
regexp => qr/^ regexp => qr/^
\QREVOKE SELECT ON TABLE public.regress_pg_dump_table_added FROM regress_dump_test_role;\E \QREVOKE SELECT ON TABLE public.regress_pg_dump_table_added FROM regress_dump_test_role;\E
\n/xm, \n/xm,

View File

@ -389,7 +389,7 @@ sub set_replication_conf
if ($TestLib::windows_os) if ($TestLib::windows_os)
{ {
print $hba print $hba
"host replication all $test_localhost/32 sspi include_realm=1 map=regress\n"; "host replication all $test_localhost/32 sspi include_realm=1 map=regress\n";
} }
close $hba; close $hba;
} }
@ -652,7 +652,7 @@ sub init_from_backup
$params{has_restoring} = 0 unless defined $params{has_restoring}; $params{has_restoring} = 0 unless defined $params{has_restoring};
print print
"# Initializing node \"$node_name\" from backup \"$backup_name\" of node \"$root_name\"\n"; "# Initializing node \"$node_name\" from backup \"$backup_name\" of node \"$root_name\"\n";
croak "Backup \"$backup_name\" does not exist at $backup_path" croak "Backup \"$backup_name\" does not exist at $backup_path"
unless -d $backup_path; unless -d $backup_path;
@ -1272,7 +1272,7 @@ sub psql
die "connection error: '$$stderr'\nwhile running '@psql_params'" die "connection error: '$$stderr'\nwhile running '@psql_params'"
if $ret == 2; if $ret == 2;
die die
"error running SQL: '$$stderr'\nwhile running '@psql_params' with sql '$sql'" "error running SQL: '$$stderr'\nwhile running '@psql_params' with sql '$sql'"
if $ret == 3; if $ret == 3;
die "psql returns $ret: '$$stderr'\nwhile running '@psql_params'"; die "psql returns $ret: '$$stderr'\nwhile running '@psql_params'";
} }
@ -1544,7 +1544,7 @@ sub wait_for_catchup
. $lsn_expr . " on " . $lsn_expr . " on "
. $self->name . "\n"; . $self->name . "\n";
my $query = my $query =
qq[SELECT $lsn_expr <= ${mode}_lsn FROM pg_catalog.pg_stat_replication WHERE application_name = '$standby_name';]; qq[SELECT $lsn_expr <= ${mode}_lsn FROM pg_catalog.pg_stat_replication WHERE application_name = '$standby_name';];
$self->poll_query_until('postgres', $query) $self->poll_query_until('postgres', $query)
or croak "timed out waiting for catchup"; or croak "timed out waiting for catchup";
print "done\n"; print "done\n";
@ -1586,7 +1586,7 @@ sub wait_for_slot_catchup
. $target_lsn . " on " . $target_lsn . " on "
. $self->name . "\n"; . $self->name . "\n";
my $query = my $query =
qq[SELECT '$target_lsn' <= ${mode}_lsn FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name';]; qq[SELECT '$target_lsn' <= ${mode}_lsn FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name';];
$self->poll_query_until('postgres', $query) $self->poll_query_until('postgres', $query)
or croak "timed out waiting for catchup"; or croak "timed out waiting for catchup";
print "done\n"; print "done\n";
@ -1661,7 +1661,7 @@ sub slot
'restart_lsn'); 'restart_lsn');
return $self->query_hash( return $self->query_hash(
'postgres', 'postgres',
"SELECT __COLUMNS__ FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name'", "SELECT __COLUMNS__ FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name'",
@columns); @columns);
} }
@ -1736,7 +1736,7 @@ sub pg_recvlogical_upto
unless $timeout->is_expired; unless $timeout->is_expired;
die die
"$exc_save waiting for endpos $endpos with stdout '$stdout', stderr '$stderr'" "$exc_save waiting for endpos $endpos with stdout '$stdout', stderr '$stderr'"
unless wantarray; unless wantarray;
} }
}; };
@ -1751,7 +1751,7 @@ sub pg_recvlogical_upto
else else
{ {
die die
"pg_recvlogical exited with code '$ret', stdout '$stdout' and stderr '$stderr'" "pg_recvlogical exited with code '$ret', stdout '$stdout' and stderr '$stderr'"
if $ret; if $ret;
return $stdout; return $stdout;
} }

View File

@ -95,7 +95,7 @@ sub test_target_session_attrs
extra_params => [ '-d', $connstr ]); extra_params => [ '-d', $connstr ]);
is( $status == $ret && $stdout eq $target_node->port, is( $status == $ret && $stdout eq $target_node->port,
1, 1,
"connect to node $target_name if mode \"$mode\" and $node1_name,$node2_name listed" "connect to node $target_name if mode \"$mode\" and $node1_name,$node2_name listed"
); );
} }
@ -183,7 +183,7 @@ $node_master->safe_psql('postgres', 'CREATE TABLE replayed(val integer);');
sub replay_check sub replay_check
{ {
my $newval = $node_master->safe_psql('postgres', my $newval = $node_master->safe_psql('postgres',
'INSERT INTO replayed(val) SELECT coalesce(max(val),0) + 1 AS newval FROM replayed RETURNING val' 'INSERT INTO replayed(val) SELECT coalesce(max(val),0) + 1 AS newval FROM replayed RETURNING val'
); );
$node_master->wait_for_catchup($node_standby_1, 'replay', $node_master->wait_for_catchup($node_standby_1, 'replay',
$node_master->lsn('insert')); $node_master->lsn('insert'));

View File

@ -24,10 +24,11 @@ $node_master->safe_psql('postgres',
qq[CREATE TABLE decoding_test(x integer, y text);]); qq[CREATE TABLE decoding_test(x integer, y text);]);
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
qq[SELECT pg_create_logical_replication_slot('test_slot', 'test_decoding');]); qq[SELECT pg_create_logical_replication_slot('test_slot', 'test_decoding');]
);
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,10) s;] qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,10) s;]
); );
# Basic decoding works # Basic decoding works
@ -50,7 +51,7 @@ is($result, '', 'Decoding after fast restart repeats no rows');
# Insert some rows and verify that we get the same results from pg_recvlogical # Insert some rows and verify that we get the same results from pg_recvlogical
# and the SQL interface. # and the SQL interface.
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,4) s;] qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,4) s;]
); );
my $expected = q{BEGIN my $expected = q{BEGIN
@ -61,12 +62,12 @@ table public.decoding_test: INSERT: x[integer]:4 y[text]:'4'
COMMIT}; COMMIT};
my $stdout_sql = $node_master->safe_psql('postgres', my $stdout_sql = $node_master->safe_psql('postgres',
qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');] qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');]
); );
is($stdout_sql, $expected, 'got expected output from SQL decoding session'); is($stdout_sql, $expected, 'got expected output from SQL decoding session');
my $endpos = $node_master->safe_psql('postgres', my $endpos = $node_master->safe_psql('postgres',
"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
); );
print "waiting to replay $endpos\n"; print "waiting to replay $endpos\n";
@ -79,7 +80,7 @@ is($stdout_recv, $expected,
'got same expected output from pg_recvlogical decoding session'); 'got same expected output from pg_recvlogical decoding session');
$node_master->poll_query_until('postgres', $node_master->poll_query_until('postgres',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)"
) or die "slot never became inactive"; ) or die "slot never became inactive";
$stdout_recv = $node_master->pg_recvlogical_upto( $stdout_recv = $node_master->pg_recvlogical_upto(
@ -94,13 +95,13 @@ $node_master->safe_psql('postgres', 'CREATE DATABASE otherdb');
is( $node_master->psql( is( $node_master->psql(
'otherdb', 'otherdb',
"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
), ),
3, 3,
'replaying logical slot from another database fails'); 'replaying logical slot from another database fails');
$node_master->safe_psql('otherdb', $node_master->safe_psql('otherdb',
qq[SELECT pg_create_logical_replication_slot('otherdb_slot', 'test_decoding');] qq[SELECT pg_create_logical_replication_slot('otherdb_slot', 'test_decoding');]
); );
# make sure you can't drop a slot while active # make sure you can't drop a slot while active
@ -114,7 +115,7 @@ SKIP:
[ 'pg_recvlogical', '-d', $node_master->connstr('otherdb'), [ 'pg_recvlogical', '-d', $node_master->connstr('otherdb'),
'-S', 'otherdb_slot', '-f', '-', '--start' ]); '-S', 'otherdb_slot', '-f', '-', '--start' ]);
$node_master->poll_query_until('otherdb', $node_master->poll_query_until('otherdb',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)"
) or die "slot never became active"; ) or die "slot never became active";
is($node_master->psql('postgres', 'DROP DATABASE otherdb'), is($node_master->psql('postgres', 'DROP DATABASE otherdb'),
3, 'dropping a DB with active logical slots fails'); 3, 'dropping a DB with active logical slots fails');
@ -124,7 +125,7 @@ SKIP:
} }
$node_master->poll_query_until('otherdb', $node_master->poll_query_until('otherdb',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)"
) or die "slot never became inactive"; ) or die "slot never became inactive";
is($node_master->psql('postgres', 'DROP DATABASE otherdb'), is($node_master->psql('postgres', 'DROP DATABASE otherdb'),

View File

@ -7,7 +7,7 @@ use Test::More tests => 11;
# Query checking sync_priority and sync_state of each standby # Query checking sync_priority and sync_state of each standby
my $check_sql = my $check_sql =
"SELECT application_name, sync_priority, sync_state FROM pg_stat_replication ORDER BY application_name;"; "SELECT application_name, sync_priority, sync_state FROM pg_stat_replication ORDER BY application_name;";
# Check that sync_state of each standby is expected (waiting till it is). # Check that sync_state of each standby is expected (waiting till it is).
# If $setting is given, synchronous_standby_names is set to it and # If $setting is given, synchronous_standby_names is set to it and

View File

@ -48,7 +48,7 @@ $node_master->start;
note "testing logical timeline following with a filesystem-level copy"; note "testing logical timeline following with a filesystem-level copy";
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
"SELECT pg_create_logical_replication_slot('before_basebackup', 'test_decoding');" "SELECT pg_create_logical_replication_slot('before_basebackup', 'test_decoding');"
); );
$node_master->safe_psql('postgres', "CREATE TABLE decoding(blah text);"); $node_master->safe_psql('postgres', "CREATE TABLE decoding(blah text);");
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
@ -60,7 +60,8 @@ $node_master->safe_psql('postgres',
# the same physical copy trick, so: # the same physical copy trick, so:
$node_master->safe_psql('postgres', 'CREATE DATABASE dropme;'); $node_master->safe_psql('postgres', 'CREATE DATABASE dropme;');
$node_master->safe_psql('dropme', $node_master->safe_psql('dropme',
"SELECT pg_create_logical_replication_slot('dropme_slot', 'test_decoding');"); "SELECT pg_create_logical_replication_slot('dropme_slot', 'test_decoding');"
);
$node_master->safe_psql('postgres', 'CHECKPOINT;'); $node_master->safe_psql('postgres', 'CHECKPOINT;');
@ -95,7 +96,7 @@ is($node_master->slot('dropme_slot')->{'slot_name'},
# Back to testing failover... # Back to testing failover...
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
"SELECT pg_create_logical_replication_slot('after_basebackup', 'test_decoding');" "SELECT pg_create_logical_replication_slot('after_basebackup', 'test_decoding');"
); );
$node_master->safe_psql('postgres', $node_master->safe_psql('postgres',
"INSERT INTO decoding(blah) VALUES ('afterbb');"); "INSERT INTO decoding(blah) VALUES ('afterbb');");
@ -141,7 +142,7 @@ $node_replica->safe_psql('postgres',
# Shouldn't be able to read from slot created after base backup # Shouldn't be able to read from slot created after base backup
($ret, $stdout, $stderr) = $node_replica->psql('postgres', ($ret, $stdout, $stderr) = $node_replica->psql('postgres',
"SELECT data FROM pg_logical_slot_peek_changes('after_basebackup', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');" "SELECT data FROM pg_logical_slot_peek_changes('after_basebackup', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');"
); );
is($ret, 3, 'replaying from after_basebackup slot fails'); is($ret, 3, 'replaying from after_basebackup slot fails');
like( like(
@ -152,7 +153,7 @@ like(
# Should be able to read from slot created before base backup # Should be able to read from slot created before base backup
($ret, $stdout, $stderr) = $node_replica->psql( ($ret, $stdout, $stderr) = $node_replica->psql(
'postgres', 'postgres',
"SELECT data FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');", "SELECT data FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');",
timeout => 30); timeout => 30);
is($ret, 0, 'replay from slot before_basebackup succeeds'); is($ret, 0, 'replay from slot before_basebackup succeeds');
@ -174,7 +175,7 @@ is($stderr, '', 'replay from slot before_basebackup produces no stderr');
# of the last transaction. There's no max(pg_lsn), so: # of the last transaction. There's no max(pg_lsn), so:
my $endpos = $node_replica->safe_psql('postgres', my $endpos = $node_replica->safe_psql('postgres',
"SELECT lsn FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" "SELECT lsn FROM pg_logical_slot_peek_changes('before_basebackup', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
); );
# now use the walsender protocol to peek the slot changes and make sure we see # now use the walsender protocol to peek the slot changes and make sure we see

View File

@ -177,7 +177,7 @@ recovery_target_timeline='latest'
$node_standby->start; $node_standby->start;
$psql_rc = $node_master->psql('postgres', "COMMIT PREPARED 'xact_012_1'"); $psql_rc = $node_master->psql('postgres', "COMMIT PREPARED 'xact_012_1'");
is($psql_rc, '0', is($psql_rc, '0',
"Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby" "Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
); );
$node_master->psql( $node_master->psql(
@ -218,7 +218,7 @@ recovery_target_timeline='latest'
$node_standby->start; $node_standby->start;
$psql_rc = $node_master->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'"); $psql_rc = $node_master->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'");
is($psql_rc, '0', is($psql_rc, '0',
"Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby" "Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
); );
$node_master->psql( $node_master->psql(

View File

@ -111,7 +111,7 @@ SELECT 1;
ok( pump_until( ok( pump_until(
$killme, $killme,
\$killme_stderr, \$killme_stderr,
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m
), ),
"psql query died successfully after SIGQUIT"); "psql query died successfully after SIGQUIT");
$killme_stderr = ''; $killme_stderr = '';
@ -124,7 +124,7 @@ $killme->finish;
ok( pump_until( ok( pump_until(
$monitor, $monitor,
\$monitor_stderr, \$monitor_stderr,
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m
), ),
"psql monitor died successfully after SIGQUIT"); "psql monitor died successfully after SIGQUIT");
$monitor->finish; $monitor->finish;
@ -204,7 +204,7 @@ $killme->finish;
ok( pump_until( ok( pump_until(
$monitor, $monitor,
\$monitor_stderr, \$monitor_stderr,
qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m qr/WARNING: terminating connection because of crash of another server process|server closed the connection unexpectedly/m
), ),
"psql monitor died successfully after SIGKILL"); "psql monitor died successfully after SIGKILL");
$monitor->finish; $monitor->finish;
@ -220,7 +220,8 @@ is( $node->safe_psql('postgres', 'SELECT * FROM alive'),
is( $node->safe_psql( is( $node->safe_psql(
'postgres', 'postgres',
'INSERT INTO alive VALUES($$before-orderly-restart$$) RETURNING status'), 'INSERT INTO alive VALUES($$before-orderly-restart$$) RETURNING status'
),
'before-orderly-restart', 'before-orderly-restart',
'can still write after crash restart'); 'can still write after crash restart');
@ -228,7 +229,7 @@ is( $node->safe_psql(
$node->restart(); $node->restart();
is( $node->safe_psql('postgres', 'SELECT * FROM alive'), is( $node->safe_psql('postgres', 'SELECT * FROM alive'),
"committed-before-sigquit\ncommitted-before-sigkill\nbefore-orderly-restart", "committed-before-sigquit\ncommitted-before-sigkill\nbefore-orderly-restart",
'data survived'); 'data survived');
is( $node->safe_psql( is( $node->safe_psql(

View File

@ -91,10 +91,10 @@ sub configure_test_server_for_ssl
if (defined($password)) if (defined($password))
{ {
$node->psql('postgres', $node->psql('postgres',
"SET password_encryption='$password_enc'; ALTER USER ssltestuser PASSWORD '$password';" "SET password_encryption='$password_enc'; ALTER USER ssltestuser PASSWORD '$password';"
); );
$node->psql('postgres', $node->psql('postgres',
"SET password_encryption='$password_enc'; ALTER USER anotheruser PASSWORD '$password';" "SET password_encryption='$password_enc'; ALTER USER anotheruser PASSWORD '$password';"
); );
} }
@ -161,14 +161,14 @@ sub configure_hba_for_ssl
# When connecting to certdb, also check the client certificate. # When connecting to certdb, also check the client certificate.
open my $hba, '>', "$pgdata/pg_hba.conf"; open my $hba, '>', "$pgdata/pg_hba.conf";
print $hba print $hba
"# TYPE DATABASE USER ADDRESS METHOD\n"; "# TYPE DATABASE USER ADDRESS METHOD\n";
print $hba print $hba
"hostssl trustdb all $serverhost/32 $authmethod\n"; "hostssl trustdb all $serverhost/32 $authmethod\n";
print $hba print $hba
"hostssl trustdb all ::1/128 $authmethod\n"; "hostssl trustdb all ::1/128 $authmethod\n";
print $hba print $hba
"hostssl certdb all $serverhost/32 cert\n"; "hostssl certdb all $serverhost/32 cert\n";
print $hba print $hba
"hostssl certdb all ::1/128 cert\n"; "hostssl certdb all ::1/128 cert\n";
close $hba; close $hba;
} }

View File

@ -88,7 +88,7 @@ note "running client tests";
switch_server_cert($node, 'server-cn-only'); switch_server_cert($node, 'server-cn-only');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test"; "user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test";
# The server should not accept non-SSL connections. # The server should not accept non-SSL connections.
test_connect_fails( test_connect_fails(
@ -167,20 +167,20 @@ test_connect_ok(
# A CRL belonging to a different CA is not accepted, fails # A CRL belonging to a different CA is not accepted, fails
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/client.crl", "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/client.crl",
qr/SSL error/, qr/SSL error/,
"CRL belonging to a different CA"); "CRL belonging to a different CA");
# With the correct CRL, succeeds (this cert is not revoked) # With the correct CRL, succeeds (this cert is not revoked)
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl",
"CRL with a non-revoked cert"); "CRL with a non-revoked cert");
# Check that connecting with verify-full fails, when the hostname doesn't # Check that connecting with verify-full fails, when the hostname doesn't
# match the hostname in the server's certificate. # match the hostname in the server's certificate.
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
@ -193,14 +193,14 @@ test_connect_ok(
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"sslmode=verify-full host=wronghost.test", "sslmode=verify-full host=wronghost.test",
qr/\Qserver certificate for "common-name.pg-ssltest.test" does not match host name "wronghost.test"\E/, qr/\Qserver certificate for "common-name.pg-ssltest.test" does not match host name "wronghost.test"\E/,
"mismatch between host name and server certificate sslmode=verify-full"); "mismatch between host name and server certificate sslmode=verify-full");
# Test Subject Alternative Names. # Test Subject Alternative Names.
switch_server_cert($node, 'server-multiple-alt-names'); switch_server_cert($node, 'server-multiple-alt-names');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
@ -218,12 +218,12 @@ test_connect_ok(
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"host=wronghost.alt-name.pg-ssltest.test", "host=wronghost.alt-name.pg-ssltest.test",
qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "wronghost.alt-name.pg-ssltest.test"\E/, qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "wronghost.alt-name.pg-ssltest.test"\E/,
"host name not matching with X.509 Subject Alternative Names"); "host name not matching with X.509 Subject Alternative Names");
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"host=deep.subdomain.wildcard.pg-ssltest.test", "host=deep.subdomain.wildcard.pg-ssltest.test",
qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/, qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names) does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/,
"host name not matching with X.509 Subject Alternative Names wildcard"); "host name not matching with X.509 Subject Alternative Names wildcard");
# Test certificate with a single Subject Alternative Name. (this gives a # Test certificate with a single Subject Alternative Name. (this gives a
@ -231,7 +231,7 @@ qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 2 other names)
switch_server_cert($node, 'server-single-alt-name'); switch_server_cert($node, 'server-single-alt-name');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
@ -241,13 +241,13 @@ test_connect_ok(
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"host=wronghost.alt-name.pg-ssltest.test", "host=wronghost.alt-name.pg-ssltest.test",
qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "wronghost.alt-name.pg-ssltest.test"\E/, qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "wronghost.alt-name.pg-ssltest.test"\E/,
"host name not matching with a single X.509 Subject Alternative Name"); "host name not matching with a single X.509 Subject Alternative Name");
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"host=deep.subdomain.wildcard.pg-ssltest.test", "host=deep.subdomain.wildcard.pg-ssltest.test",
qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/, qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match host name "deep.subdomain.wildcard.pg-ssltest.test"\E/,
"host name not matching with a single X.509 Subject Alternative Name wildcard" "host name not matching with a single X.509 Subject Alternative Name wildcard"
); );
# Test server certificate with a CN and SANs. Per RFCs 2818 and 6125, the CN # Test server certificate with a CN and SANs. Per RFCs 2818 and 6125, the CN
@ -255,7 +255,7 @@ qr/\Qserver certificate for "single.alt-name.pg-ssltest.test" does not match hos
switch_server_cert($node, 'server-cn-and-alt-names'); switch_server_cert($node, 'server-cn-and-alt-names');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full"; "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR sslmode=verify-full";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
@ -268,14 +268,14 @@ test_connect_ok(
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"host=common-name.pg-ssltest.test", "host=common-name.pg-ssltest.test",
qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 1 other name) does not match host name "common-name.pg-ssltest.test"\E/, qr/\Qserver certificate for "dns1.alt-name.pg-ssltest.test" (and 1 other name) does not match host name "common-name.pg-ssltest.test"\E/,
"certificate with both a CN and SANs ignores CN"); "certificate with both a CN and SANs ignores CN");
# Finally, test a server certificate that has no CN or SANs. Of course, that's # Finally, test a server certificate that has no CN or SANs. Of course, that's
# not a very sensible certificate, but libpq should handle it gracefully. # not a very sensible certificate, but libpq should handle it gracefully.
switch_server_cert($node, 'server-no-names'); switch_server_cert($node, 'server-no-names');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; "user=ssltestuser dbname=trustdb sslcert=invalid sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,
@ -291,7 +291,7 @@ test_connect_fails(
switch_server_cert($node, 'server-revoked'); switch_server_cert($node, 'server-revoked');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test"; "user=ssltestuser dbname=trustdb sslcert=invalid hostaddr=$SERVERHOSTADDR host=common-name.pg-ssltest.test";
# Without the CRL, succeeds. With it, fails. # Without the CRL, succeeds. With it, fails.
test_connect_ok( test_connect_ok(
@ -300,7 +300,7 @@ test_connect_ok(
"connects without client-side CRL"); "connects without client-side CRL");
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl", "sslrootcert=ssl/root+server_ca.crt sslmode=verify-ca sslcrl=ssl/root+server.crl",
qr/SSL error/, qr/SSL error/,
"does not connect with client-side CRL"); "does not connect with client-side CRL");
@ -311,7 +311,7 @@ test_connect_fails(
note "running server tests"; note "running server tests";
$common_connstr = $common_connstr =
"sslrootcert=ssl/root+server_ca.crt sslmode=require dbname=certdb hostaddr=$SERVERHOSTADDR"; "sslrootcert=ssl/root+server_ca.crt sslmode=require dbname=certdb hostaddr=$SERVERHOSTADDR";
# no client cert # no client cert
test_connect_fails( test_connect_fails(
@ -329,8 +329,8 @@ test_connect_ok(
# client key with wrong permissions # client key with wrong permissions
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_wrongperms_tmp.key", "user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_wrongperms_tmp.key",
qr!\Qprivate key file "ssl/client_wrongperms_tmp.key" has group or world access\E!, qr!\Qprivate key file "ssl/client_wrongperms_tmp.key" has group or world access\E!,
"certificate authorization fails because of file permissions"); "certificate authorization fails because of file permissions");
# client cert belonging to another user # client cert belonging to another user
@ -338,19 +338,20 @@ test_connect_fails(
$common_connstr, $common_connstr,
"user=anotheruser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key", "user=anotheruser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key",
qr/certificate authentication failed for user "anotheruser"/, qr/certificate authentication failed for user "anotheruser"/,
"certificate authorization fails with client cert belonging to another user"); "certificate authorization fails with client cert belonging to another user"
);
# revoked client cert # revoked client cert
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"user=ssltestuser sslcert=ssl/client-revoked.crt sslkey=ssl/client-revoked_tmp.key", "user=ssltestuser sslcert=ssl/client-revoked.crt sslkey=ssl/client-revoked_tmp.key",
qr/SSL error/, qr/SSL error/,
"certificate authorization fails with revoked client cert"); "certificate authorization fails with revoked client cert");
# intermediate client_ca.crt is provided by client, and isn't in server's ssl_ca_file # intermediate client_ca.crt is provided by client, and isn't in server's ssl_ca_file
switch_server_cert($node, 'server-cn-only', 'root_ca'); switch_server_cert($node, 'server-cn-only', 'root_ca');
$common_connstr = $common_connstr =
"user=ssltestuser dbname=certdb sslkey=ssl/client_tmp.key sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR"; "user=ssltestuser dbname=certdb sslkey=ssl/client_tmp.key sslrootcert=ssl/root+server_ca.crt hostaddr=$SERVERHOSTADDR";
test_connect_ok( test_connect_ok(
$common_connstr, $common_connstr,

View File

@ -68,7 +68,7 @@ else
test_connect_fails( test_connect_fails(
$common_connstr, $common_connstr,
"scram_channel_binding=tls-server-end-point", "scram_channel_binding=tls-server-end-point",
qr/channel binding type "tls-server-end-point" is not supported by this build/, qr/channel binding type "tls-server-end-point" is not supported by this build/,
"SCRAM authentication with tls-server-end-point as channel binding"); "SCRAM authentication with tls-server-end-point as channel binding");
$number_of_tests++; $number_of_tests++;
} }

View File

@ -32,7 +32,7 @@ $node_publisher->safe_psql('postgres',
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"INSERT INTO tab_mixed (a, b) VALUES (1, 'foo')"); "INSERT INTO tab_mixed (a, b) VALUES (1, 'foo')");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE TABLE tab_include (a int, b text, CONSTRAINT covering PRIMARY KEY(a) INCLUDE(b))" "CREATE TABLE tab_include (a int, b text, CONSTRAINT covering PRIMARY KEY(a) INCLUDE(b))"
); );
# Setup structure on subscriber # Setup structure on subscriber
@ -49,7 +49,7 @@ $node_subscriber->safe_psql('postgres',
# replication of the table with included index # replication of the table with included index
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE TABLE tab_include (a int, b text, CONSTRAINT covering PRIMARY KEY(a) INCLUDE(b))" "CREATE TABLE tab_include (a int, b text, CONSTRAINT covering PRIMARY KEY(a) INCLUDE(b))"
); );
# Setup logical replication # Setup logical replication
@ -58,21 +58,21 @@ $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)"); "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed, tab_include" "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed, tab_include"
); );
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins"); "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins");
my $appname = 'tap_sub'; my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub, tap_pub_ins_only" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub, tap_pub_ins_only"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Also wait for initial table sync to finish # Also wait for initial table sync to finish
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";
@ -168,20 +168,20 @@ my $oldpid = $node_publisher->safe_psql('postgres',
"SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';" "SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';"
); );
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"ALTER SUBSCRIPTION tap_sub CONNECTION 'application_name=$appname $publisher_connstr'" "ALTER SUBSCRIPTION tap_sub CONNECTION 'application_name=$appname $publisher_connstr'"
); );
$node_publisher->poll_query_until('postgres', $node_publisher->poll_query_until('postgres',
"SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';" "SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';"
) or die "Timed out while waiting for apply to restart"; ) or die "Timed out while waiting for apply to restart";
$oldpid = $node_publisher->safe_psql('postgres', $oldpid = $node_publisher->safe_psql('postgres',
"SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';" "SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';"
); );
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_ins_only WITH (copy_data = false)" "ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_ins_only WITH (copy_data = false)"
); );
$node_publisher->poll_query_until('postgres', $node_publisher->poll_query_until('postgres',
"SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';" "SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';"
) or die "Timed out while waiting for apply to restart"; ) or die "Timed out while waiting for apply to restart";
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
@ -230,7 +230,7 @@ $oldpid = $node_publisher->safe_psql('postgres',
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"ALTER SUBSCRIPTION tap_sub RENAME TO tap_sub_renamed"); "ALTER SUBSCRIPTION tap_sub RENAME TO tap_sub_renamed");
$node_publisher->poll_query_until('postgres', $node_publisher->poll_query_until('postgres',
"SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';" "SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';"
) or die "Timed out while waiting for apply to restart"; ) or die "Timed out while waiting for apply to restart";
# check all the cleanup # check all the cleanup

View File

@ -103,14 +103,14 @@ $node_publisher->safe_psql('postgres',
my $appname = 'tap_sub'; my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (slot_name = tap_sub_slot)" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (slot_name = tap_sub_slot)"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Wait for initial sync to finish as well # Wait for initial sync to finish as well
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";

View File

@ -19,14 +19,14 @@ $node_subscriber->start;
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE TABLE tab_fk (bid int PRIMARY KEY);"); "CREATE TABLE tab_fk (bid int PRIMARY KEY);");
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE TABLE tab_fk_ref (id int PRIMARY KEY, bid int REFERENCES tab_fk (bid));" "CREATE TABLE tab_fk_ref (id int PRIMARY KEY, bid int REFERENCES tab_fk (bid));"
); );
# Setup structure on subscriber # Setup structure on subscriber
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE TABLE tab_fk (bid int PRIMARY KEY);"); "CREATE TABLE tab_fk (bid int PRIMARY KEY);");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE TABLE tab_fk_ref (id int PRIMARY KEY, bid int REFERENCES tab_fk (bid));" "CREATE TABLE tab_fk_ref (id int PRIMARY KEY, bid int REFERENCES tab_fk (bid));"
); );
# Setup logical replication # Setup logical replication
@ -36,7 +36,7 @@ $node_publisher->safe_psql('postgres',
my $appname = 'tap_sub'; my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);

View File

@ -34,14 +34,14 @@ $node_publisher->safe_psql('postgres',
my $appname = 'tap_sub'; my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Also wait for initial table sync to finish # Also wait for initial table sync to finish
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";
@ -57,7 +57,7 @@ $node_publisher->safe_psql('postgres',
# recreate the subscription, it will try to do initial copy # recreate the subscription, it will try to do initial copy
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub"
); );
# but it will be stuck on data copy as it will fail on constraint # but it will be stuck on data copy as it will fail on constraint
@ -79,12 +79,12 @@ is($result, qq(20), 'initial data synced for second sub');
# now check another subscription for the same node pair # now check another subscription for the same node pair
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub2 CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)" "CREATE SUBSCRIPTION tap_sub2 CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)"
); );
# wait for it to start # wait for it to start
$node_subscriber->poll_query_until('postgres', $node_subscriber->poll_query_until('postgres',
"SELECT pid IS NOT NULL FROM pg_stat_subscription WHERE subname = 'tap_sub2' AND relid IS NULL" "SELECT pid IS NOT NULL FROM pg_stat_subscription WHERE subname = 'tap_sub2' AND relid IS NULL"
) or die "Timed out while waiting for subscriber to start"; ) or die "Timed out while waiting for subscriber to start";
# and drop both subscriptions # and drop both subscriptions
@ -101,7 +101,7 @@ $node_subscriber->safe_psql('postgres', "DELETE FROM tab_rep;");
# recreate the subscription again # recreate the subscription again
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub"
); );
# and wait for data sync to finish again # and wait for data sync to finish again

View File

@ -27,14 +27,14 @@ my $appname = 'encoding_test';
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION mypub FOR ALL TABLES;"); "CREATE PUBLICATION mypub FOR ALL TABLES;");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;" "CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Wait for initial sync to finish as well # Wait for initial sync to finish as well
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";

View File

@ -23,14 +23,14 @@ my $appname = 'encoding_test';
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION mypub FOR ALL TABLES;"); "CREATE PUBLICATION mypub FOR ALL TABLES;");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;" "CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Wait for initial sync to finish as well # Wait for initial sync to finish as well
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";

View File

@ -23,7 +23,7 @@ my $appname = 'replication_test';
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION mypub FOR ALL TABLES;"); "CREATE PUBLICATION mypub FOR ALL TABLES;");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;" "CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);

View File

@ -23,7 +23,7 @@ $node_publisher->safe_psql('postgres',
# Setup structure on subscriber # Setup structure on subscriber
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999, e int GENERATED BY DEFAULT AS IDENTITY)" "CREATE TABLE test_tab (a int primary key, b text, c timestamptz DEFAULT now(), d bigint DEFAULT 999, e int GENERATED BY DEFAULT AS IDENTITY)"
); );
# Setup logical replication # Setup logical replication
@ -33,14 +33,14 @@ $node_publisher->safe_psql('postgres',
my $appname = 'tap_sub'; my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub" "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub"
); );
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
# Also wait for initial table sync to finish # Also wait for initial table sync to finish
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";
@ -73,7 +73,7 @@ $node_publisher->safe_psql('postgres',
$node_publisher->wait_for_catchup($appname); $node_publisher->wait_for_catchup($appname);
$result = $node_subscriber->safe_psql('postgres', $result = $node_subscriber->safe_psql('postgres',
"SELECT count(*), count(extract(epoch from c) = 987654321), count(d = 999) FROM test_tab" "SELECT count(*), count(extract(epoch from c) = 987654321), count(d = 999) FROM test_tab"
); );
is($result, qq(2|2|2), 'check extra columns contain locally changed data'); is($result, qq(2|2|2), 'check extra columns contain locally changed data');

View File

@ -19,7 +19,7 @@ my $appname = 'replication_test';
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION mypub FOR ALL TABLES;"); "CREATE PUBLICATION mypub FOR ALL TABLES;");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;" "CREATE SUBSCRIPTION mysub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION mypub;"
); );
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',

View File

@ -52,18 +52,18 @@ $node_publisher->safe_psql('postgres',
$node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres',
"CREATE PUBLICATION pub3 FOR TABLE tab3, tab4"); "CREATE PUBLICATION pub3 FOR TABLE tab3, tab4");
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr application_name=sub1' PUBLICATION pub1" "CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr application_name=sub1' PUBLICATION pub1"
); );
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub2 CONNECTION '$publisher_connstr application_name=sub2' PUBLICATION pub2" "CREATE SUBSCRIPTION sub2 CONNECTION '$publisher_connstr application_name=sub2' PUBLICATION pub2"
); );
$node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION sub3 CONNECTION '$publisher_connstr application_name=sub3' PUBLICATION pub3" "CREATE SUBSCRIPTION sub3 CONNECTION '$publisher_connstr application_name=sub3' PUBLICATION pub3"
); );
# Wait for initial sync of all subscriptions # Wait for initial sync of all subscriptions
my $synced_query = my $synced_query =
"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');"; "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
$node_subscriber->poll_query_until('postgres', $synced_query) $node_subscriber->poll_query_until('postgres', $synced_query)
or die "Timed out while waiting for subscriber to synchronize data"; or die "Timed out while waiting for subscriber to synchronize data";

View File

@ -82,7 +82,7 @@ while (<>)
&& !grep { $cur_nonterminal eq $_ } @rhs) && !grep { $cur_nonterminal eq $_ } @rhs)
{ {
print print
"Right recursion in rule $rule_number: $cur_nonterminal := $rhs\n"; "Right recursion in rule $rule_number: $cur_nonterminal := $rhs\n";
} }
} }
} }

View File

@ -37,7 +37,7 @@ exit 0 if $1 >= 36;
# Apply the desired patch. # Apply the desired patch.
$ccode =~ $ccode =~
s|(struct yyguts_t \* yyg = \(struct yyguts_t\*\)yyscanner; /\* This var may be unused depending upon options. \*/ s|(struct yyguts_t \* yyg = \(struct yyguts_t\*\)yyscanner; /\* This var may be unused depending upon options. \*/
.*?) .*?)
return yy_is_jam \? 0 : yy_current_state; return yy_is_jam \? 0 : yy_current_state;
|$1 |$1

View File

@ -343,7 +343,7 @@ sub parse_datetime
{ {
my ($dt) = @_; my ($dt) = @_;
$dt =~ $dt =~
/^(\d\d\d\d)-(\d\d)-(\d\d)\s+(\d\d):(\d\d):(\d\d)\s+([-+])(\d\d)(\d\d)$/; /^(\d\d\d\d)-(\d\d)-(\d\d)\s+(\d\d):(\d\d):(\d\d)\s+([-+])(\d\d)(\d\d)$/;
my $gm = Time::Local::timegm($6, $5, $4, $3, $2 - 1, $1); my $gm = Time::Local::timegm($6, $5, $4, $3, $2 - 1, $1);
my $tzoffset = ($8 * 60 + $9) * 60; my $tzoffset = ($8 * 60 + $9) * 60;
$tzoffset = -$tzoffset if $7 eq '-'; $tzoffset = -$tzoffset if $7 eq '-';

View File

@ -361,14 +361,14 @@ sub GenerateConversionScript
my $obj = shift @pieces; my $obj = shift @pieces;
$sql .= "-- $se --> $de\n"; $sql .= "-- $se --> $de\n";
$sql .= $sql .=
"CREATE OR REPLACE FUNCTION $func (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '\$libdir/$obj', '$func' LANGUAGE C STRICT;\n"; "CREATE OR REPLACE FUNCTION $func (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '\$libdir/$obj', '$func' LANGUAGE C STRICT;\n";
$sql .= $sql .=
"COMMENT ON FUNCTION $func(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) IS 'internal conversion function for $se to $de';\n"; "COMMENT ON FUNCTION $func(INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) IS 'internal conversion function for $se to $de';\n";
$sql .= "DROP CONVERSION pg_catalog.$name;\n"; $sql .= "DROP CONVERSION pg_catalog.$name;\n";
$sql .= $sql .=
"CREATE DEFAULT CONVERSION pg_catalog.$name FOR '$se' TO '$de' FROM $func;\n"; "CREATE DEFAULT CONVERSION pg_catalog.$name FOR '$se' TO '$de' FROM $func;\n";
$sql .= $sql .=
"COMMENT ON CONVERSION pg_catalog.$name IS 'conversion for $se to $de';\n\n"; "COMMENT ON CONVERSION pg_catalog.$name IS 'conversion for $se to $de';\n\n";
} }
open($F, '>', "$target/share/conversion_create.sql") open($F, '>', "$target/share/conversion_create.sql")
|| die "Could not write to conversion_create.sql\n"; || die "Could not write to conversion_create.sql\n";
@ -554,7 +554,7 @@ sub CopySubdirFiles
# Special case for contrib/spi # Special case for contrib/spi
$flist = $flist =
"autoinc.example insert_username.example moddatetime.example refint.example timetravel.example" "autoinc.example insert_username.example moddatetime.example refint.example timetravel.example"
if ($module eq 'spi'); if ($module eq 'spi');
foreach my $f (split /\s+/, $flist) foreach my $f (split /\s+/, $flist)
{ {
@ -713,7 +713,7 @@ sub GenerateNLSFiles
my @args = ( my @args = (
"$nlspath\\bin\\msgfmt", "$nlspath\\bin\\msgfmt",
'-o', '-o',
"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo", "$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo",
$_); $_);
system(@args) && croak("Could not run msgfmt on $dir\\$_"); system(@args) && croak("Could not run msgfmt on $dir\\$_");
print "."; print ".";

View File

@ -170,7 +170,7 @@ EOF
if ($grammarFile =~ /\.y$/) if ($grammarFile =~ /\.y$/)
{ {
$outputFile =~ $outputFile =~
s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c}; s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
print $f <<EOF; print $f <<EOF;
<CustomBuild Include="$grammarFile"> <CustomBuild Include="$grammarFile">
<Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running bison on $grammarFile</Message> <Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running bison on $grammarFile</Message>
@ -328,7 +328,7 @@ EOF
if ($self->{disablelinkerwarnings}) if ($self->{disablelinkerwarnings})
{ {
print $f print $f
" <AdditionalOptions>/ignore:$self->{disablelinkerwarnings} \%(AdditionalOptions)</AdditionalOptions>\n"; " <AdditionalOptions>/ignore:$self->{disablelinkerwarnings} \%(AdditionalOptions)</AdditionalOptions>\n";
} }
if ($self->{implib}) if ($self->{implib})
{ {

View File

@ -543,7 +543,7 @@ sub mkvcbuild
else else
{ {
die die
"could not identify perl library version matching pattern $perl_path\n"; "could not identify perl library version matching pattern $perl_path\n";
} }
# Add defines from Perl's ccflags; see PGAC_CHECK_PERL_EMBED_CCFLAGS # Add defines from Perl's ccflags; see PGAC_CHECK_PERL_EMBED_CCFLAGS

View File

@ -157,7 +157,7 @@ sub GenerateFiles
{ {
s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}$extraver"}; s{PG_VERSION "[^"]+"}{PG_VERSION "$self->{strver}$extraver"};
s{PG_VERSION_NUM \d+}{PG_VERSION_NUM $self->{numver}}; s{PG_VERSION_NUM \d+}{PG_VERSION_NUM $self->{numver}};
s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, compiled by Visual C++ build " CppAsString2(_MSC_VER) ", $bits-bit"}; s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, compiled by Visual C++ build " CppAsString2(_MSC_VER) ", $bits-bit"};
print $o $_; print $o $_;
} }
print $o "#define PG_MAJORVERSION \"$self->{majorver}\"\n"; print $o "#define PG_MAJORVERSION \"$self->{majorver}\"\n";
@ -271,7 +271,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
|| IsNewer('fmgrtab.c', '../../../src/include/access/transam.h')) || IsNewer('fmgrtab.c', '../../../src/include/access/transam.h'))
{ {
system( system(
"perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ $pg_language_dat $pg_proc_dat" "perl -I ../catalog Gen_fmgrtab.pl -I../../../src/include/ $pg_language_dat $pg_proc_dat"
); );
} }
chdir('../../..'); chdir('../../..');
@ -322,7 +322,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating probes.h...\n"; print "Generating probes.h...\n";
system( system(
'perl src/backend/utils/Gen_dummy_probes.pl src/backend/utils/probes.d > src/include/utils/probes.h' 'perl src/backend/utils/Gen_dummy_probes.pl src/backend/utils/probes.d > src/include/utils/probes.h'
); );
} }
@ -333,7 +333,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating spiexceptions.h...\n"; print "Generating spiexceptions.h...\n";
system( system(
'perl src/pl/plpython/generate-spiexceptions.pl src/backend/utils/errcodes.txt > src/pl/plpython/spiexceptions.h' 'perl src/pl/plpython/generate-spiexceptions.pl src/backend/utils/errcodes.txt > src/pl/plpython/spiexceptions.h'
); );
} }
@ -343,7 +343,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating errcodes.h...\n"; print "Generating errcodes.h...\n";
system( system(
'perl src/backend/utils/generate-errcodes.pl src/backend/utils/errcodes.txt > src/backend/utils/errcodes.h' 'perl src/backend/utils/generate-errcodes.pl src/backend/utils/errcodes.txt > src/backend/utils/errcodes.h'
); );
copyFile('src/backend/utils/errcodes.h', copyFile('src/backend/utils/errcodes.h',
'src/include/utils/errcodes.h'); 'src/include/utils/errcodes.h');
@ -355,7 +355,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating plerrcodes.h...\n"; print "Generating plerrcodes.h...\n";
system( system(
'perl src/pl/plpgsql/src/generate-plerrcodes.pl src/backend/utils/errcodes.txt > src/pl/plpgsql/src/plerrcodes.h' 'perl src/pl/plpgsql/src/generate-plerrcodes.pl src/backend/utils/errcodes.txt > src/pl/plpgsql/src/plerrcodes.h'
); );
} }
@ -365,7 +365,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating pltclerrcodes.h...\n"; print "Generating pltclerrcodes.h...\n";
system( system(
'perl src/pl/tcl/generate-pltclerrcodes.pl src/backend/utils/errcodes.txt > src/pl/tcl/pltclerrcodes.h' 'perl src/pl/tcl/generate-pltclerrcodes.pl src/backend/utils/errcodes.txt > src/pl/tcl/pltclerrcodes.h'
); );
} }
@ -375,7 +375,7 @@ s{PG_VERSION_STR "[^"]+"}{PG_VERSION_STR "PostgreSQL $self->{strver}$extraver, c
{ {
print "Generating qsort_tuple.c...\n"; print "Generating qsort_tuple.c...\n";
system( system(
'perl src/backend/utils/sort/gen_qsort_tuple.pl > src/backend/utils/sort/qsort_tuple.c' 'perl src/backend/utils/sort/gen_qsort_tuple.pl > src/backend/utils/sort/qsort_tuple.c'
); );
} }

View File

@ -130,7 +130,7 @@ EOF
my $obj = $dir; my $obj = $dir;
$obj =~ s!/!_!g; $obj =~ s!/!_!g;
print $f print $f
"><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj" "><FileConfiguration Name=\"Debug|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\debug\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj" . "_$file.obj\" /></FileConfiguration><FileConfiguration Name=\"Release|$self->{platform}\"><Tool Name=\"VCCLCompilerTool\" ObjectFile=\".\\release\\$self->{name}\\$obj"
. "_$file.obj\" /></FileConfiguration></File>\n"; . "_$file.obj\" /></FileConfiguration></File>\n";
} }
@ -195,7 +195,7 @@ EOF
if ($self->{disablelinkerwarnings}) if ($self->{disablelinkerwarnings})
{ {
print $f print $f
"\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n"; "\t\tAdditionalOptions=\"/ignore:$self->{disablelinkerwarnings}\"\n";
} }
if ($self->{implib}) if ($self->{implib})
{ {
@ -212,13 +212,13 @@ EOF
print $f "\t/>\n"; print $f "\t/>\n";
print $f print $f
"\t<Tool Name=\"VCLibrarianTool\" OutputFile=\".\\$cfgname\\$self->{name}\\$self->{name}.lib\" IgnoreDefaultLibraryNames=\"libc\" />\n"; "\t<Tool Name=\"VCLibrarianTool\" OutputFile=\".\\$cfgname\\$self->{name}\\$self->{name}.lib\" IgnoreDefaultLibraryNames=\"libc\" />\n";
print $f print $f
"\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n"; "\t<Tool Name=\"VCResourceCompilerTool\" AdditionalIncludeDirectories=\"src\\include\" />\n";
if ($self->{builddef}) if ($self->{builddef})
{ {
print $f print $f
"\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}\" />\n"; "\t<Tool Name=\"VCPreLinkEventTool\" Description=\"Generate DEF file\" CommandLine=\"perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}\" />\n";
} }
print $f <<EOF; print $f <<EOF;
</Configuration> </Configuration>
@ -232,7 +232,7 @@ sub WriteReferences
foreach my $ref (@{ $self->{references} }) foreach my $ref (@{ $self->{references} })
{ {
print $f print $f
" <ProjectReference ReferencedProjectIdentifier=\"$ref->{guid}\" Name=\"$ref->{name}\" />\n"; " <ProjectReference ReferencedProjectIdentifier=\"$ref->{guid}\" Name=\"$ref->{name}\" />\n";
} }
print $f " </References>\n"; print $f " </References>\n";
} }
@ -246,7 +246,7 @@ sub GenerateCustomTool
. $self->GenerateCustomTool($desc, $tool, $output, 'Release'); . $self->GenerateCustomTool($desc, $tool, $output, 'Release');
} }
return return
"<FileConfiguration Name=\"$cfg|$self->{platform}\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>"; "<FileConfiguration Name=\"$cfg|$self->{platform}\"><Tool Name=\"VCCustomBuildTool\" Description=\"$desc\" CommandLine=\"$tool\" AdditionalDependencies=\"\" Outputs=\"$output\" /></FileConfiguration>";
} }
package VC2005Project; package VC2005Project;

View File

@ -123,14 +123,14 @@ sub DetermineVisualStudioVersion
my $output = `nmake /? 2>&1`; my $output = `nmake /? 2>&1`;
$? >> 8 == 0 $? >> 8 == 0
or croak or croak
"Unable to determine Visual Studio version: The nmake command wasn't found."; "Unable to determine Visual Studio version: The nmake command wasn't found.";
if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m) if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?$/m)
{ {
return _GetVisualStudioVersion($1, $2); return _GetVisualStudioVersion($1, $2);
} }
croak croak
"Unable to determine Visual Studio version: The nmake version could not be determined."; "Unable to determine Visual Studio version: The nmake version could not be determined.";
} }
sub _GetVisualStudioVersion sub _GetVisualStudioVersion
@ -141,13 +141,13 @@ sub _GetVisualStudioVersion
if ($major > 14) if ($major > 14)
{ {
carp carp
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead."; "The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
return '14.00'; return '14.00';
} }
elsif ($major < 6) elsif ($major < 6)
{ {
croak croak
"Unable to determine Visual Studio version: Visual Studio versions before 6.0 aren't supported."; "Unable to determine Visual Studio version: Visual Studio versions before 6.0 aren't supported.";
} }
return "$major.$minor"; return "$major.$minor";
} }

View File

@ -56,7 +56,7 @@ elsif (uc($ARGV[0]) ne "RELEASE")
if ($buildwhat and $vcver >= 10.00) if ($buildwhat and $vcver >= 10.00)
{ {
system( system(
"msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf" "msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
); );
} }
elsif ($buildwhat) elsif ($buildwhat)
@ -66,7 +66,8 @@ elsif ($buildwhat)
else else
{ {
system( system(
"msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"); "msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
);
} }
# report status # report status

View File

@ -58,7 +58,7 @@ $cmd =
system($cmd); system($cmd);
die "features_unsupported" if $?; die "features_unsupported" if $?;
$cmd = $cmd =
"perl generate-errcodes-table.pl \"../../../src/backend/utils/errcodes.txt\" " "perl generate-errcodes-table.pl \"../../../src/backend/utils/errcodes.txt\" "
. "> errcodes-table.sgml"; . "> errcodes-table.sgml";
system($cmd); system($cmd);
die "errcodes-table" if $?; die "errcodes-table" if $?;

View File

@ -34,7 +34,7 @@ if (-e "src/tools/msvc/buildenv.pl")
my $what = shift || ""; my $what = shift || "";
if ($what =~ if ($what =~
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i /^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
) )
{ {
$what = uc $what; $what = uc $what;

View File

@ -119,7 +119,7 @@ foreach my $file (@hfiles, @cfiles)
$top_builddir = $top_builddir . "/.."; $top_builddir = $top_builddir . "/..";
} }
$MAKECMD = $MAKECMD =
"$MAKE -qp 'subdir=$subdir' 'top_builddir=$top_builddir' -f '$top_builddir/src/Makefile.global'"; "$MAKE -qp 'subdir=$subdir' 'top_builddir=$top_builddir' -f '$top_builddir/src/Makefile.global'";
} }
my ($CPPFLAGS, $CFLAGS, $CFLAGS_SL, $PTHREAD_CFLAGS, $CC); my ($CPPFLAGS, $CFLAGS, $CFLAGS_SL, $PTHREAD_CFLAGS, $CC);

View File

@ -5,6 +5,7 @@
--entab-leading-whitespace=4 --entab-leading-whitespace=4
--keep-old-blank-lines=2 --keep-old-blank-lines=2
--maximum-line-length=78 --maximum-line-length=78
--nooutdent-long-quotes
--nospace-for-semicolon --nospace-for-semicolon
--opening-brace-on-new-line --opening-brace-on-new-line
--output-line-ending=unix --output-line-ending=unix

View File

@ -16,7 +16,7 @@ my $INDENT_VERSION = "2.0";
# Our standard indent settings # Our standard indent settings
my $indent_opts = my $indent_opts =
"-bad -bap -bbb -bc -bl -cli1 -cp33 -cdb -nce -d0 -di12 -nfc1 -i4 -l79 -lp -lpl -nip -npro -sac -tpg -ts4"; "-bad -bap -bbb -bc -bl -cli1 -cp33 -cdb -nce -d0 -di12 -nfc1 -i4 -l79 -lp -lpl -nip -npro -sac -tpg -ts4";
my $devnull = File::Spec->devnull; my $devnull = File::Spec->devnull;
@ -82,7 +82,7 @@ sub check_indent
if (`$indent --version` !~ m/ $INDENT_VERSION$/) if (`$indent --version` !~ m/ $INDENT_VERSION$/)
{ {
print STDERR print STDERR
"You do not appear to have $indent version $INDENT_VERSION installed on your system.\n"; "You do not appear to have $indent version $INDENT_VERSION installed on your system.\n";
exit 1; exit 1;
} }
@ -211,7 +211,7 @@ sub pre_indent
my $extern_c_start = '/* Open extern "C" */'; my $extern_c_start = '/* Open extern "C" */';
my $extern_c_stop = '/* Close extern "C" */'; my $extern_c_stop = '/* Close extern "C" */';
$source =~ $source =~
s!(^#ifdef[ \t]+__cplusplus.*\nextern[ \t]+"C"[ \t]*\n)\{[ \t]*$!$1$extern_c_start!gm; s!(^#ifdef[ \t]+__cplusplus.*\nextern[ \t]+"C"[ \t]*\n)\{[ \t]*$!$1$extern_c_start!gm;
$source =~ s!(^#ifdef[ \t]+__cplusplus.*\n)\}[ \t]*$!$1$extern_c_stop!gm; $source =~ s!(^#ifdef[ \t]+__cplusplus.*\n)\}[ \t]*$!$1$extern_c_stop!gm;
# Protect wrapping in CATALOG() # Protect wrapping in CATALOG()

View File

@ -83,8 +83,8 @@ my $aconfver = "";
open(my $fh, '<', "configure.in") || die "could not read configure.in: $!\n"; open(my $fh, '<', "configure.in") || die "could not read configure.in: $!\n";
while (<$fh>) while (<$fh>)
{ {
if ( if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/
m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], \[m4_fatal/) )
{ {
$aconfver = $1; $aconfver = $1;
last; last;
@ -99,29 +99,29 @@ $aconfver ne ""
my $fixedfiles = ""; my $fixedfiles = "";
sed_file("configure.in", sed_file("configure.in",
"-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'" "-e 's/AC_INIT(\\[PostgreSQL\\], \\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'"
); );
sed_file("doc/bug.template", sed_file("doc/bug.template",
"-e 's/PostgreSQL version (example: PostgreSQL .*) *: PostgreSQL .*/PostgreSQL version (example: PostgreSQL $fullversion): PostgreSQL $fullversion/'" "-e 's/PostgreSQL version (example: PostgreSQL .*) *: PostgreSQL .*/PostgreSQL version (example: PostgreSQL $fullversion): PostgreSQL $fullversion/'"
); );
sed_file("src/include/pg_config.h.win32", sed_file("src/include/pg_config.h.win32",
"-e 's/#define PACKAGE_STRING \"PostgreSQL .*\"/#define PACKAGE_STRING \"PostgreSQL $fullversion\"/' " "-e 's/#define PACKAGE_STRING \"PostgreSQL .*\"/#define PACKAGE_STRING \"PostgreSQL $fullversion\"/' "
. "-e 's/#define PACKAGE_VERSION \".*\"/#define PACKAGE_VERSION \"$fullversion\"/' " . "-e 's/#define PACKAGE_VERSION \".*\"/#define PACKAGE_VERSION \"$fullversion\"/' "
. "-e 's/#define PG_VERSION \".*\"/#define PG_VERSION \"$fullversion\"/' " . "-e 's/#define PG_VERSION \".*\"/#define PG_VERSION \"$fullversion\"/' "
. "-e 's/#define PG_VERSION_NUM .*/#define PG_VERSION_NUM $padnumericversion/'" . "-e 's/#define PG_VERSION_NUM .*/#define PG_VERSION_NUM $padnumericversion/'"
); );
sed_file("src/interfaces/libpq/libpq.rc.in", sed_file("src/interfaces/libpq/libpq.rc.in",
"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' " "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' "
. "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/' " . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/' "
. "-e 's/VALUE \"FileVersion\", \"[0-9.]*/VALUE \"FileVersion\", \"$numericversion/' " . "-e 's/VALUE \"FileVersion\", \"[0-9.]*/VALUE \"FileVersion\", \"$numericversion/' "
. "-e 's/VALUE \"ProductVersion\", \"[0-9.]*/VALUE \"ProductVersion\", \"$numericversion/'" . "-e 's/VALUE \"ProductVersion\", \"[0-9.]*/VALUE \"ProductVersion\", \"$numericversion/'"
); );
sed_file("src/port/win32ver.rc", sed_file("src/port/win32ver.rc",
"-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' " "-e 's/FILEVERSION [0-9]*,[0-9]*,[0-9]*,0/FILEVERSION $majorversion,0,$numericminor,0/' "
. "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/'" . "-e 's/PRODUCTVERSION [0-9]*,[0-9]*,[0-9]*,0/PRODUCTVERSION $majorversion,0,$numericminor,0/'"
); );

View File

@ -102,7 +102,7 @@ for my $sys (@system_zones)
if ($sys->{display} ne $file->{display}) if ($sys->{display} ne $file->{display})
{ {
print print
"Timezone $sys->{std} changed displayname ('$sys->{display}' from '$file->{display}')!\n"; "Timezone $sys->{std} changed displayname ('$sys->{display}' from '$file->{display}')!\n";
} }
last; last;
} }
@ -119,7 +119,7 @@ if (@add)
for my $z (@add) for my $z (@add)
{ {
print print
"\t{\n\t\t\"$z->{std}\", \"$z->{dlt}\",\n\t\t\"FIXME\"\n\t},\t\t\t\t\t\t\t/* $z->{display} */\n"; "\t{\n\t\t\"$z->{std}\", \"$z->{dlt}\",\n\t\t\"FIXME\"\n\t},\t\t\t\t\t\t\t/* $z->{display} */\n";
} }
} }