Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 93230
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: greg [...] turnstep.com
Requestors: hans [...] matfyz.cz
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.19.2
Fixed in: (no value)



Subject: return field names aftre prepare()
Hello! It seems that DBD::Pg does not return query field names in $st->{NAME} after $st = $dbh->prepare(q{SELECT * FROM table}). For MySQL, Oracle, DB2, I get the names. Why it is necessary to do $st->execute first for Postgres? DBD::Pg version 2.19.3 perl version v5.14.2 Best regards HG
From: hans [...] matfyz.cz
Same for DBD::Pg version 3.0.0. Dne Pá 21.úno.2014 12:44:42, https://launchpad.net/~hans-matfyz napsal(a): Show quoted text
> Hello! > > It seems that DBD::Pg does not return query field names in $st->{NAME} > after $st = $dbh->prepare(q{SELECT * FROM table}). > > For MySQL, Oracle, DB2, I get the names. > > Why it is necessary to do $st->execute first for Postgres? > > DBD::Pg version 2.19.3 > perl version v5.14.2 > > Best regards > HG
Show quoted text
> Why it is necessary to do $st->execute first for Postgres?
Two reasons. First, because we do not send the query to the backend until we are actually ready to run it. This allows things like binding to change before the first execute is called. Second, Postgres will only give us that information on execute anyway, so there is no gain in changing the current behavior as far as this attribute is concerned.