Pg reverse-engineering fix: varchar with no limit
[DBIx-DBSchema.git] / DBSchema / DBD / Pg.pm
index 20bd721..33d6665 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw($VERSION @ISA %typemap);
 use DBIx::DBSchema::DBD;
 
-$VERSION = '0.05';
+$VERSION = '0.06';
 @ISA = qw(DBIx::DBSchema::DBD);
 
 %typemap = (
@@ -57,7 +57,8 @@ END
     };
 
     my $len = '';
-    if ( $_->{attlen} == -1 && $_->{typname} ne 'text' ) {
+    if ( $_->{attlen} == -1 && $_->{atttypmod} != -1 
+         && $_->{typname} ne 'text'                  ) {
       $len = $_->{atttypmod} - 4;
       if ( $_->{typname} eq 'numeric' ) {
         $len = ($len >> 16). ','. ($len & 0xffff);