Blame SOURCES/DBD-Pg-3.7.4-Inline-no-longer-conditional-catalog-query-fragments.patch

1b4a88
From c73d40c6e219621c4bdc1fe9cadd52b7f09e8560 Mon Sep 17 00:00:00 2001
1b4a88
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
1b4a88
Date: Mon, 31 Dec 2018 18:45:57 +0100
1b4a88
Subject: [PATCH] Inline no-longer-conditional catalog query fragments
1b4a88
MIME-Version: 1.0
1b4a88
Content-Type: text/plain; charset=UTF-8
1b4a88
Content-Transfer-Encoding: 8bit
1b4a88
1b4a88
Some bits of catalog queries needed version-specific variants, but when
1b4a88
support for the versions that necessitated them was removed, the
1b4a88
variables were left in place.  This removes these now-unnecessary
1b4a88
variables and puts the SQL fragments back in the query.
1b4a88
1b4a88
The pg_get_expr() call does not need to be conditional, it exists in 7.4
1b4a88
too: https://www.postgresql.org/docs/7.4/functions-misc.html
1b4a88
1b4a88
Petr Písař: Ported to 3.7.4 from
1b4a88
c7ea8fd90b5fc09f28e090e0e00cbb2708eda4cc.
1b4a88
1b4a88
Signed-off-by: Petr Písař <ppisar@redhat.com>
1b4a88
---
1b4a88
 Pg.pm | 14 +++-----------
1b4a88
 1 file changed, 3 insertions(+), 11 deletions(-)
1b4a88
1b4a88
diff --git a/Pg.pm b/Pg.pm
1b4a88
index 9c664e9..5658d1b 100644
1b4a88
--- a/Pg.pm
1b4a88
+++ b/Pg.pm
1b4a88
@@ -443,14 +443,6 @@ use 5.008001;
1b4a88
 
1b4a88
 		my $whereclause = join "\n\t\t\t\tAND ", '', @search;
1b4a88
 
1b4a88
-		my $schemajoin = 'JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)';
1b4a88
-
1b4a88
-		my $remarks = 'pg_catalog.col_description(a.attrelid, a.attnum)';
1b4a88
-
1b4a88
-		my $column_def = $dbh->{private_dbdpg}{version} >= 80000
1b4a88
-			? 'pg_catalog.pg_get_expr(af.adbin, af.adrelid)'
1b4a88
-			: 'af.adsrc';
1b4a88
-
1b4a88
 		my $col_info_sql = qq!
1b4a88
             SELECT
1b4a88
                 NULL::text AS "TABLE_CAT"
1b4a88
@@ -464,8 +456,8 @@ use 5.008001;
1b4a88
                 , NULL::text AS "DECIMAL_DIGITS"
1b4a88
                 , NULL::text AS "NUM_PREC_RADIX"
1b4a88
                 , CASE a.attnotnull WHEN 't' THEN 0 ELSE 1 END AS "NULLABLE"
1b4a88
-                , $remarks AS "REMARKS"
1b4a88
-                , $column_def AS "COLUMN_DEF"
1b4a88
+                , pg_catalog.col_description(a.attrelid, a.attnum) AS "REMARKS"
1b4a88
+                , pg_catalog.pg_get_expr(af.adbin, af.adrelid) AS "COLUMN_DEF"
1b4a88
                 , NULL::text AS "SQL_DATA_TYPE"
1b4a88
                 , NULL::text AS "SQL_DATETIME_SUB"
1b4a88
                 , NULL::text AS "CHAR_OCTET_LENGTH"
1b4a88
@@ -486,7 +478,7 @@ use 5.008001;
1b4a88
                 JOIN pg_catalog.pg_attribute a ON (t.oid = a.atttypid)
1b4a88
                 JOIN pg_catalog.pg_class c ON (a.attrelid = c.oid)
1b4a88
                 LEFT JOIN pg_catalog.pg_attrdef af ON (a.attnum = af.adnum AND a.attrelid = af.adrelid)
1b4a88
-                $schemajoin
1b4a88
+                JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)
1b4a88
             WHERE
1b4a88
                 a.attnum >= 0
1b4a88
                 AND c.relkind IN ('r','v','m')
1b4a88
-- 
1b4a88
2.21.0
1b4a88