Skip Menu |

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

Report information
The Basics
Id: 101390
Status: rejected
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: ulrich [...] chirlu.de
Cc:
AdminCc:

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



Subject: COPY FROM broken in 3.5.0
Date: Thu, 08 Jan 2015 03:41:09 +0100
To: bug-DBD-Pg [...] rt.cpan.org
From: Ulrich Klauer <ulrich [...] chirlu.de>
With 3.5.0, this COPY FROM no longer works: $sql->begin; $sql->do("COPY table FROM stdin"); my $dbh = $sql->dbh; while (<LOAD>) { $dbh->pg_putcopydata($_); } $dbh->pg_putcopyend(); (Simplified to just the database commands; see https://github.com/metabrainz/musicbrainz-server/blob/master/admin/MBImport.pl#L274 for the full story, if necessary.) The error message is: "DBD::Pg::db pg_putcopydata failed: no COPY in progress"; the Postgres server also logs this error: "COPY from stdin failed: COPY terminated by new PQexec" After downgrading to 3.4.2, it works again. I suspect it is related to the ping changes in 3.5.0 (RT #100648); possibly pg_putcopydata tries to ping the server, inadvertently terminating copy mode. Ulrich
Subject: [rt.cpan.org #101390] Re: COPY FROM broken in 3.5.0
Date: Thu, 08 Jan 2015 12:28:53 +0100
To: bug-DBD-Pg [...] rt.cpan.org
From: Ulrich Klauer <ulrich [...] chirlu.de>
I further looked into this; it seems the culprit is DBIx::Connector's dbh method, which "will use a an [sic] existing handle if there is one, if the process has not been forked or a new thread spawned, and if the database is pingable". Hence, in my code ... 1 $sql->do("COPY table FROM stdin"); 2 my $dbh = $sql->dbh; 3 while (<LOAD>) { $dbh->pg_putcopydata($_); } ... line 2 indirectly calls the ping method, which was a harmless no-op (mostly) up to DBD::Pg 3.4.2, but as of 3.5.0 really sends a command to the server, breaking COPY mode. I was able to fix it simply by swapping lines 1 and 2. So this bug should be closed as invalid, I guess. Sorry to have bothered you. :-) Ulrich