[rt.cpan.org #20435] New COPY support breaks old idiom

"Michael_G_Schwern via RT" <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
Wed Jul 12 14:08:17 2006: Request 20435 was acted upon.
Transaction: Ticket created by MSCHWERN
       Queue: DBD-Pg
     Subject: New COPY support breaks old idiom
   Broken in: 1.49
    Severity: Normal
       Owner: Nobody
  Requestors: [email protected]
      Status: new
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=20435 >


I'm upgrading DBD::Pg from 1.32 to 1.49 and my existing code is breaking
due to the new COPY support methods not allowing the old idiom for
copying to work.

With 1.32 the code did this:

    $dbh->do("COPY $table ( $fields ) FROM STDIN");
    $dbh->func($line,   "putline");
    $dbh->func("\\.\n", "putline");
    $dbh->func("endcopy");

But that code no longer works.  DBD::Pg 1.49 complains "Must call
pg_endcopy before issuing more commands".  But pg_endcopy() was added in
1.41 and I need to support earlier versions.

This is problematic as there's now no cross-version compatible way to
copy a table (if there is, please let me know).

We are experiencing a similar problem with

    $dbh->do("ROLLBACK TO SAVEPOINT $savepoint_name");

DBD::Pg 1.32 complains that we're trying to do a ROLLBACK via do() and
should instead use the method.  It doesn't understand we're doing a
different kind of rollback and 1.32 has no savepoint methods.  I'm glad
to see this "helpful" check has been removed in 1.49.

It would be nice if these sorts of "helpful" checks were turned from
errors into warnings and the old idioms be allowed to work in the new
versions to facilitate upgrades.
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.