From: Dagfinn Ilmari Mannsåker Date: Sun, 13 Sep 2015 16:38:38 +0000 (+0100) Subject: Eliminate redundant query in Pg _column_comment X-Git-Tag: 0.07044~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8791d9f87ade4a4beadf02716e59d2f72a7b25e;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Eliminate redundant query in Pg _column_comment --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm index a70106a..131fbd3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm @@ -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