Skip to content

Commit de34123

Browse files
committed
pg_dump: Skip COLLATION-related regression tests
Not every platform supports non-default collations, as pointed out by the buildfarm, so skip collation-related regression tests in pg_dump when they aren't supported.
1 parent 839da3c commit de34123

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@
427427
catch_all =>
428428
'ALTER ... OWNER commands (except LARGE OBJECTs and PUBLICATIONs)',
429429
regexp => qr/^ALTER COLLATION test0 OWNER TO .*;/m,
430+
collation => 1,
430431
like => {
431432
binary_upgrade => 1,
432433
clean => 1,
@@ -1707,6 +1708,7 @@
17071708
create_sql => 'COMMENT ON COLLATION test0
17081709
IS \'comment on test0 collation\';',
17091710
regexp => qr/^COMMENT ON COLLATION test0 IS 'comment on test0 collation';/m,
1711+
collation => 1,
17101712
like => {
17111713
binary_upgrade => 1,
17121714
clean => 1,
@@ -2423,6 +2425,7 @@
24232425
regexp =>
24242426
qr/^
24252427
\QCREATE COLLATION test0 (lc_collate = 'C', lc_ctype = 'C');\E/xm,
2428+
collation => 1,
24262429
like => {
24272430
binary_upgrade => 1,
24282431
clean => 1,
@@ -6090,6 +6093,17 @@
60906093
60916094
my $port = $node->port;
60926095
6096+
# We need to see if this system supports CREATE COLLATION or not
6097+
# If it doesn't then we will skip all the COLLATION-related tests.
6098+
my $collation_support = 0;
6099+
my $collation_check_stderr;
6100+
$node->psql('postgres',"CREATE COLLATION testing FROM \"C\"; DROP COLLATION testing;", on_error_stop => 0, stderr => \$collation_check_stderr);
6101+
6102+
if ($collation_check_stderr !~ /ERROR: /)
6103+
{
6104+
$collation_support = 1;
6105+
}
6106+
60936107
# Start with number of command_fails_like()*2 tests below (each
60946108
# command_fails_like is actually 2 tests)
60956109
my $num_tests = 12;
@@ -6115,6 +6129,11 @@
61156129
# Then count all the tests run against each run
61166130
foreach my $test (sort keys %tests)
61176131
{
6132+
# Skip any collation-related commands if there is no collation support
6133+
if (!$collation_support && defined($tests{$test}->{collation})) {
6134+
next;
6135+
}
6136+
61186137
if ($tests{$test}->{like}->{$test_key})
61196138
{
61206139
$num_tests++;
@@ -6181,6 +6200,11 @@
61816200
{
61826201
if ($tests{$test}->{create_sql})
61836202
{
6203+
# Skip any collation-related commands if there is no collation support
6204+
if (!$collation_support && defined($tests{$test}->{collation})) {
6205+
next;
6206+
}
6207+
61846208
$create_sql .= $tests{$test}->{create_sql};
61856209
}
61866210
}
@@ -6258,6 +6282,11 @@
62586282
62596283
foreach my $test (sort keys %tests)
62606284
{
6285+
# Skip any collation-related commands if there is no collation support
6286+
if (!$collation_support && defined($tests{$test}->{collation})) {
6287+
next;
6288+
}
6289+
62616290
if ($tests{$test}->{like}->{$test_key})
62626291
{
62636292
like($output_file, $tests{$test}->{regexp}, "$run: dumps $test");

0 commit comments

Comments
 (0)