On Thu, May 6, 2021 at 5:42 PM Michael Paquier <mich...@paquier.xyz> wrote:
>
> On Thu, May 06, 2021 at 10:45:53AM +0530, Dilip Kumar wrote:
> > Thanks, Robert and Michael for your input.  I will try to understand
> > how it is done in the example shared by you and come up with the test
> > once I get time.  I assume this is not something urgent.
>
> Thanks.  FWIW, I'd rather see this gap closed asap, as features should
> come with proper tests IMO.

I have done this please find the attached patch.

>
> While on it, I can see that there is no support for --with-lz4 in the
> MSVC scripts.  I think that this is something where we had better
> close the gap, and upstream provides binaries on Windows on their
> release page:
> https://github.com/lz4/lz4/releases
>
> And I am familiar with both areas, so I have no helping out and
> getting that in shape correctly before beta1.

I don't have much idea about the MSVC script, but I will try to see
some other parameters and fix this.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
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

Reply via email to