[svn:DBD-Pg] r12634 - DBD-Pg/trunk

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Thu Mar 26 08:29:48 2009
New Revision: 12634

Modified:
   DBD-Pg/trunk/Changes
   DBD-Pg/trunk/Pg.pm

Log:
Have column_info use a better expression.


Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes	(original)
+++ DBD-Pg/trunk/Changes	Thu Mar 26 08:29:48 2009
@@ -11,6 +11,7 @@
   - Fix a memory leak when parsing returned arrays. Reported by Bálint Szilakszi.
     [GSM] (CPAN bug #44225)
   - Do proper dequoting of boolean arrays [Armando Santos, GSM] (CPAN bug #43768)
+  - Use pg_get_expr in column_info when available [Adam Sjøgren]
   - Fix minor bugs in POD docs. [Frank Wiegand] (CPAN bug #44242)
   - Fix minor bug in POD docs. [Tim Mattison]
 

Modified: DBD-Pg/trunk/Pg.pm
==============================================================================
--- DBD-Pg/trunk/Pg.pm	(original)
+++ DBD-Pg/trunk/Pg.pm	Thu Mar 26 08:29:48 2009
@@ -433,6 +433,10 @@
 
 		my $remarks = 'pg_catalog.col_description(a.attrelid, a.attnum)';
 
+		my $column_def = $dbh->{private_dbdpg}{version} >= 80000
+			? 'pg_catalog.pg_get_expr(af.adbin, af.adrelid)'
+			: 'af.adsrc';
+
 		my $col_info_sql = qq!
 			SELECT
 				NULL::text AS "TABLE_CAT"
@@ -447,7 +451,7 @@
 				, NULL::text AS "NUM_PREC_RADIX"
 				, CASE a.attnotnull WHEN 't' THEN 0 ELSE 1 END AS "NULLABLE"
 				, $remarks AS "REMARKS"
-				, af.adsrc AS "COLUMN_DEF"
+				, $column_def AS "COLUMN_DEF"
 				, NULL::text AS "SQL_DATA_TYPE"
 				, NULL::text AS "SQL_DATETIME_SUB"
 				, NULL::text AS "CHAR_OCTET_LENGTH"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.