X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FPg.pm;h=14ad3604943803a02289d09aa75041d25ea49fa8;hb=dc783fab900d073db1fb0e86b709cbb65bd364b7;hp=8d3a745b04a85f30e429171aa68f4c958180a4fb;hpb=53c4835c7c3e764f0881b196fb29f348916e8411;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm index 8d3a745..14ad360 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm @@ -5,7 +5,7 @@ use warnings; use base 'DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault'; use mro 'c3'; -our $VERSION = '0.07040'; +our $VERSION = '0.07045'; =head1 NAME @@ -184,13 +184,11 @@ sub _column_comment { return $column_comment if $column_comment; - my ($table_oid) = $self->dbh->selectrow_array(<<'EOF', {}, $table->name, $table->schema); -SELECT oid + return $self->dbh->selectrow_array(<<'EOF', {}, $column_number, $table->name, $table->schema); +SELECT pg_catalog.col_description(oid, ?) FROM pg_catalog.pg_class WHERE relname=? AND relnamespace=(SELECT oid FROM pg_catalog.pg_namespace WHERE nspname=?) EOF - - return $self->dbh->selectrow_array('SELECT pg_catalog.col_description(?,?)', {}, $table_oid, $column_number); } # Make sure data_type's that don't need it don't have a 'size' column_info, and @@ -227,7 +225,7 @@ WHERE table_name = ? and column_name = ? EOF if ($data_type =~ /^time\b/i) { - if ((not $precision) || $precision !~ /^\d/) { + if ((not defined $precision) || $precision !~ /^\d/) { delete $info->{size}; } else { @@ -245,7 +243,7 @@ EOF } } } - elsif ((not $precision) || $precision !~ /^\d/ || $precision == 6) { + elsif ((not defined $precision) || $precision !~ /^\d/ || $precision == 6) { delete $info->{size}; } else { @@ -291,11 +289,10 @@ FROM pg_catalog.pg_type WHERE typname = ? EOF if ($typetype && $typetype eq 'e') { - # The following will extract a list of allowed values for the - # enum. + # The following will extract a list of allowed values for the enum. my $order_column = $self->dbh->{pg_server_version} >= 90100 ? 'enumsortorder' : 'oid'; - my $typevalues = $self->dbh - ->selectall_arrayref(<{data_type}); + $info->{extra}{list} = $self->dbh + ->selectcol_arrayref(<{data_type}); SELECT e.enumlabel FROM pg_catalog.pg_enum e JOIN pg_catalog.pg_type t ON t.oid = e.enumtypid @@ -303,8 +300,6 @@ WHERE t.typname = ? ORDER BY e.$order_column EOF - $info->{extra}{list} = [ map { $_->[0] } @$typevalues ]; - # Store its original name in extra for SQLT to pick up. $info->{extra}{custom_type_name} = $info->{data_type}; @@ -352,9 +347,9 @@ EOF L, L, L -=head1 AUTHOR +=head1 AUTHORS -See L and L. +See L. =head1 LICENSE