Skip Menu |

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

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

People
Owner: greg [...] turnstep.com
Requestors: caseyandgina [...] icloud.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Support DBI's PrintErrorStatement = 1
Date: Wed, 15 Feb 2017 14:23:39 -0800
To: bug-DBD-Pg [...] rt.cpan.org
From: Casey & Gina Shobe <caseyandgina [...] icloud.com>
As shown below, DBD::Pg does not currently honor DBI's PrintErrorStatement = 1 setting: $ cat test #!/usr/local/bin/perl use strict; use warnings; use English; use DBI; my $database = DBI->connect ( 'dbi:Pg:host=localhost;port=5432;dbname=management', 'app_database_management', 'password', { AutoCommit => 0, RaiseError => 1, PrintError => 0, ShowErrorStatement => 1 } ); $database->do ('select 1 + 3 from asrocidasoercid'); $ ./test DBD::Pg::db do failed: ERROR: relation "asrocidasoercid" does not exist LINE 4: asrocidasoercid ^ at ./test line 19. Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle host=localhost;port=5432;dbname=management at ./test line 19.
On Wed Feb 15 18:23:58 2017, caseyandgina@icloud.com wrote: Show quoted text
> As shown below, DBD::Pg does not currently honor DBI's > PrintErrorStatement = 1 setting:
(I think you mean ShowErrorStatement). DBD::Pg does honor it, but do() without any arguments uses a "quick path" optimization which does not use the underlying prepare/execute code, which ShowErrorStatement relies upon to grab the statement. I'm not sure if there is a way to make it work easily, so I will leave this open. You should be able to confirm ShowErrorStatement works in other cases like this: $dbh->{ShowErrorStatement} = 1; $dbh->do("SELECT ?::invalid", undef, 123); ## AND: $sth = $dbh->prepare("invalid"); $sth->execute();
I cannot see a way to make this work, so I added a documentation note in b1e78f723ed2ceda1616157b2ca808637e2da3bf and will close this ticket.