I've a patch submitted to add PRECISION support, however it's not that useful
in Pg.  For any varchar type column the value is -1.

Two alternatives:

If column_info is supported in the current version:
 my $cols = $dbh_pg->column_info( undef, undef, undef, "column_name" );

Also, perldoc DBD::Pg shows:
 my $attrs = $dbh->func($table, 'table_attributes');

I actually used both in my current project, first column_info, then the
function call if column_info is not supported.  I use them to get the table's
primary key.

Tom

On Thu, Oct 03, 2002 at 03:30:00PM -0500, R. Steven Rainwater wrote:
> I have some code that relies on getting the column
> name, type, and width, which I am porting for use with 
> PostgreSQL and DBD::Pg. No problem with the name and type 
> attributes but width relies on the $sth->{PRECISION} 
> statement handle attribute which isn't supported in DBD::Pg.
> Is there any alternate way of finding out column widths
> using DBI (or SQL perhaps)?

-- 
Thomas A. Lowery
See DBI/FAQ http://xmlproj.dyndns.org/cgi-bin/fom

Reply via email to