v1-0001-Add-pg_dump-test-case-for-TOAST-compression.patch
text/x-patch
Filename: v1-0001-Add-pg_dump-test-case-for-TOAST-compression.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch v1-0001
Subject: Add pg_dump test case for TOAST compression
| File | + | − |
|---|---|---|
| src/bin/pg_dump/t/002_pg_dump.pl | 39 | 0 |
From 104fc883f5e4ca4e268c29350de0cf173065cb68 Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilipkumar@localhost.localdomain>
Date: Thu, 6 May 2021 21:32:12 +0530
Subject: [PATCH v1] Add pg_dump test case for TOAST compression
---
src/bin/pg_dump/t/002_pg_dump.pl | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 86113df..197d677 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -2334,6 +2334,26 @@ my %tests = (
unlike => { exclude_dump_test_schema => 1, },
},
+ 'CREATE TABLE test_compression' => {
+ create_order => 3,
+ create_sql => 'CREATE TABLE dump_test.test_compression (
+ col1 int,
+ col2 text COMPRESSION lz4
+ );',
+ regexp => qr/^
+ \QCREATE TABLE dump_test.test_compression (\E\n
+ \s+\Qcol1 integer,\E\n
+ \s+\Qcol2 text\E\n
+ \);\n
+ .*
+ \QALTER TABLE ONLY dump_test.test_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n
+ /xms,
+ lz4 => 1,
+ like =>
+ { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ unlike => { exclude_dump_test_schema => 1, },
+ },
+
'CREATE TABLE measurement PARTITIONED BY' => {
create_order => 90,
create_sql => 'CREATE TABLE dump_test.measurement (
@@ -3377,6 +3397,7 @@ my $port = $node->port;
# If it doesn't then we will skip all the COLLATION-related tests.
my $collation_support = 0;
my $collation_check_stderr;
+my $supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1");
$node->psql(
'postgres',
"CREATE COLLATION testing FROM \"C\"; DROP COLLATION testing;",
@@ -3445,6 +3466,12 @@ foreach my $run (sort keys %pgdump_runs)
next;
}
+ # Skip any lz4 compression related test
+ if (!$supports_lz4 && defined($tests{$test}->{lz4}))
+ {
+ next;
+ }
+
# If there is a like entry, but no unlike entry, then we will test the like case
if ($tests{$test}->{like}->{$test_key}
&& !defined($tests{$test}->{unlike}->{$test_key}))
@@ -3502,6 +3529,12 @@ foreach my $test (
next;
}
+ # Skip any lz4 compression related test
+ if (!$supports_lz4 && defined($tests{$test}->{lz4}))
+ {
+ next;
+ }
+
# Add terminating semicolon
$create_sql{$test_db} .= $tests{$test}->{create_sql} . ";";
}
@@ -3600,6 +3633,12 @@ foreach my $run (sort keys %pgdump_runs)
next;
}
+ # Skip any lz4 compression related test
+ if (!$supports_lz4 && defined($tests{$test}->{lz4}))
+ {
+ next;
+ }
+
if ($run_db ne $test_db)
{
next;
--
1.8.3.1