[DBD::Pg] Adjustments for the loss of spclocation in 9.2

dbdpg-commits-gENoVmVU/[email protected] Thu, 31 May 2012 14:10:31 -0400
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]>

Adjustments for the loss of spclocation in 9.2

---
 Pg.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Pg.pm b/Pg.pm
index ef702d1..586d37f 100644
--- a/Pg.pm
+++ b/Pg.pm
@@ -740,6 +740,10 @@ use 5.006001;
             $whereclause
         };
 
+		if ($dbh->{private_dbdpg}{version} >= 90200) {
+			$pri_key_sql =~ s/t.spclocation/pg_tablespace_location(t.oid)/;
+		}
+
 		my $sth = $dbh->prepare($pri_key_sql) or return undef;
 		$sth->execute();
 		my $info = $sth->fetchall_arrayref()->[0];
@@ -1152,6 +1156,9 @@ use 5.006001;
 			$extracols = q{,n.nspname AS pg_schema, c.relname AS pg_table};
 			my @search;
 			my $showtablespace = ', quote_ident(t.spcname) AS "pg_tablespace_name", quote_ident(t.spclocation) AS "pg_tablespace_location"';
+			if ($dbh->{private_dbdpg}{version} >= 90200) {
+				$showtablespace = ', quote_ident(t.spcname) AS "pg_tablespace_name", quote_ident(pg_tablespace_location(t.oid)) AS "pg_tablespace_location"';
+			}
 
 			## If the schema or table has an underscore or a %, use a LIKE comparison
 			if (defined $schema and length $schema) {
-- 
1.7.1