Blame SOURCES/DBD-Pg-3.7.4-Adjust-tests-for-removal-of-WITH-OIDS-in-PostgreSQL-.patch

810534
From fe47b5e148a79d0d8935293bdc05cd4444ca87cd Mon Sep 17 00:00:00 2001
810534
From: Dagfinn Ilmari Mannsaker <ilmari@sid.internal>
810534
Date: Tue, 9 Apr 2019 17:44:38 +0100
810534
Subject: [PATCH] Adjust tests for removal of WITH OIDS in PostgreSQL 12
810534
MIME-Version: 1.0
810534
Content-Type: text/plain; charset=UTF-8
810534
Content-Transfer-Encoding: 8bit
810534
810534
Petr Písař: Ported to 3.7.4 from
810534
ab1808c7b9cbac7099972105ec59b56e7d6ed5a6.
810534
810534
Signed-off-by: Petr Písař <ppisar@redhat.com>
810534
---
810534
 t/03dbmethod.t | 12 +++++++-----
810534
 1 file changed, 7 insertions(+), 5 deletions(-)
810534
810534
diff --git a/t/03dbmethod.t b/t/03dbmethod.t
810534
index a89a054..97f375e 100644
810534
--- a/t/03dbmethod.t
810534
+++ b/t/03dbmethod.t
810534
@@ -757,6 +757,8 @@ $sth = $dbh->statistics_info(undef,undef,'dbd_pg_test9',undef,undef);
810534
 is ($sth, undef, $t);
810534
 
810534
 
810534
+my $with_oids = $pgversion < 120000 ? 'WITH OIDS' : '';
810534
+my $hash_index_idx = $with_oids ? 5 : 4;
810534
 ## Create some tables with various indexes
810534
 {
810534
 	local $SIG{__WARN__} = sub {};
810534
@@ -772,10 +774,10 @@ is ($sth, undef, $t);
810534
 	$dbh->do("CREATE TABLE $table2 (a INT, b INT, c INT, PRIMARY KEY(a,b), UNIQUE(b,c))");
810534
 	$dbh->do("CREATE INDEX dbd_pg_test2_expr ON $table2(c,(a+b))");
810534
 
810534
-	$dbh->do("CREATE TABLE $table3 (a INT, b INT, c INT, PRIMARY KEY(a)) WITH OIDS");
810534
+	$dbh->do("CREATE TABLE $table3 (a INT, b INT, c INT, PRIMARY KEY(a)) $with_oids");
810534
 	$dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_index_b ON $table3(b)");
810534
 	$dbh->do("CREATE INDEX dbd_pg_test3_index_c ON $table3 USING hash(c)");
810534
-	$dbh->do("CREATE INDEX dbd_pg_test3_oid ON $table3(oid)");
810534
+	$dbh->do("CREATE INDEX dbd_pg_test3_oid ON $table3(oid)") if $with_oids;
810534
 	$dbh->do("CREATE UNIQUE INDEX dbd_pg_test3_pred ON $table3(c) WHERE c > 0 AND c < 45");
810534
 	$dbh->commit();
810534
 }
810534
@@ -801,7 +803,7 @@ one => [
810534
 	[ undef, $schema, $table3, '0', undef, 'dbd_pg_test3_index_b', 'btree',  1, 'b', 'A', '0', '1', undef, 'b' ],
810534
 	[ undef, $schema, $table3, '0', undef, 'dbd_pg_test3_pkey',    'btree',  1, 'a', 'A', '0', '1', undef, 'a' ],
810534
 	[ undef, $schema, $table3, '0', undef, 'dbd_pg_test3_pred',    'btree',  1, 'c', 'A', '0', '1', '((c > 0) AND (c < 45))', 'c' ],
810534
-	[ undef, $schema, $table3, '1', undef, 'dbd_pg_test3_oid',     'btree',  1, 'oid', 'A', '0', '1', undef, 'oid' ],
810534
+	($with_oids ? [ undef, $schema, $table3, '1', undef, 'dbd_pg_test3_oid',     'btree',  1, 'oid', 'A', '0', '1', undef, 'oid' ] : ()),
810534
 	[ undef, $schema, $table3, '1', undef, 'dbd_pg_test3_index_c', 'hashed', 1, 'c', 'A', '0', '4', undef, 'c' ],
810534
 ],
810534
 	three_uo => [
810534
@@ -834,7 +836,7 @@ $t="Correct stats output for $table3";
810534
 $sth = $dbh->statistics_info(undef,$schema,$table3,undef,undef);
810534
 $stats = $sth->fetchall_arrayref;
810534
 ## Too many intra-version differences to try for an exact number here:
810534
-$correct_stats->{three}[5][11] = $stats->[5][11] = 0;
810534
+$correct_stats->{three}[$hash_index_idx][11] = $stats->[$hash_index_idx][11] = 0;
810534
 is_deeply ($stats, $correct_stats->{three}, $t);
810534
 
810534
 $t="Correct stats output for $table3 (unique only)";
810534
@@ -856,7 +858,7 @@ is_deeply ($stats, $correct_stats->{three_uo}, $t);
810534
 	$t="Correct stats output for $table3";
810534
 	$sth = $dbh->statistics_info(undef,undef,$table3,undef,undef);
810534
 	$stats = $sth->fetchall_arrayref;
810534
-	$correct_stats->{three}[5][11] = $stats->[5][11] = 0;
810534
+	$correct_stats->{three}[$hash_index_idx][11] = $stats->[$hash_index_idx][11] = 0;
810534
 	is_deeply ($stats, $correct_stats->{three}, $t);
810534
 
810534
 	$t="Correct stats output for $table3 (unique only)";
810534
-- 
810534
2.21.0
810534