[rt.cpan.org #20282] Bug in column_info: quotes not removed

"Guest via RT" <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Tue Jul 04 19:30:09 2006: Request 20282 was acted upon.
Transaction: Ticket created by guest
       Queue: DBD-Pg
     Subject: Bug in column_info: quotes not removed
   Broken in: 1.49
    Severity: Normal
       Owner: Nobody
  Requestors: cpan-vTZ6g+WL+M4sA/[email protected]
      Status: new
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=20282 >


If a field name is a reserved word for postgres (eg: 'location'),
postgres will put double-quotes around it in the output of pg_dump, and
DBD::Pg will do it in the results of a column_info() call.

As functions like selectrow_hashref don't seem to have the
double-quotes, a problem occurs when you're using column_info to set up
web page fields (mainly their widths) for selectrow_hashref to fill in:
the hash keys won't match.  (location != "location")

If you could remove the quotes around field names in the column_info()
call, that'd be great!  I'm currently using this code to do it:

  foreach (keys %result) {
    if (m/"/) {
      my $n=$_;
      $n=~s/"//g;
      $result{$n}=$result{$_};
      delete $result{$_};
    }
  }

Thanks!
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.