Blame SOURCES/DBD-Pg-3.7.4-Remove-usage-of-deprecated-pg_attrdef.adsrc-column.patch

3f1506
From 88d2f8f1fc95bcd16e95d3fc667783fb7a9ab05b Mon Sep 17 00:00:00 2001
3f1506
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
3f1506
Date: Fri, 11 Jan 2019 23:47:29 +0000
3f1506
Subject: [PATCH] Remove usage of deprecated pg_attrdef.adsrc column
3f1506
MIME-Version: 1.0
3f1506
Content-Type: text/plain; charset=UTF-8
3f1506
Content-Transfer-Encoding: 8bit
3f1506
3f1506
It doesn't track outside change that might affect the representation,
3f1506
and will be removed in PostgreSQL 12.
3f1506
3f1506
Petr Písař: Ported to 3.7.4 from 88d2f8f1fc95bcd16e95d3fc667783fb7a9ab05b.
3f1506
---
3f1506
 Pg.pm             | 4 ++--
3f1506
3f1506
diff --git a/Pg.pm b/Pg.pm
3f1506
index 2b46800..0ffe083 100644
3f1506
--- a/Pg.pm
3f1506
+++ b/Pg.pm
3f1506
@@ -349,12 +349,12 @@ use 5.008001;
3f1506
 			$oid =~ /(\d+)/ or die qq{OID was not numeric?!?\n};
3f1506
 			$oid = $1;
3f1506
 			## This table has a primary key. Is there a sequence associated with it via a unique, indexed column?
3f1506
-			$SQL = "SELECT a.attname, i.indisprimary, pg_catalog.pg_get_expr(adbin,adrelid)\n".
3f1506
+			$SQL = "SELECT a.attname, i.indisprimary, pg_catalog.pg_get_expr(d.adbin, d.adrelid)\n".
3f1506
 				"FROM pg_catalog.pg_index i, pg_catalog.pg_attribute a, pg_catalog.pg_attrdef d\n ".
3f1506
 				"WHERE i.indrelid = $oid AND d.adrelid=a.attrelid AND d.adnum=a.attnum\n".
3f1506
 				"  AND a.attrelid = $oid AND i.indisunique IS TRUE\n".
3f1506
 				"  AND a.atthasdef IS TRUE AND i.indkey[0]=a.attnum\n".
3f1506
-				q{ AND d.adsrc ~ '^nextval'};
3f1506
+				"  AND pg_catalog.pg_get_expr(d.adbin, d.adrelid) ~ '^nextval'";
3f1506
 			$sth = $dbh->prepare($SQL);
3f1506
 			$count = $sth->execute();
3f1506
 			if (!defined $count or $count eq '0E0') {
3f1506
-- 
3f1506
2.21.0
3f1506