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

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