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

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