Subject: | DBD::Pg documentation appears inaccurate with regard to AutoCommit implementation |
DBD::Pg documentation says:
"DBD::Pg implements AutoCommit by issuing a BEGIN statement immediately
before executing a statement, and a COMMIT afterwards."
(http://search.cpan.org/~turnstep/DBD-Pg-2.19.3/Pg.pm#Transactions)
However, this is not the observed behavior (and for good
reason--PostgreSQL's default behavior is the same as AutoCommit)
A simple test script demonstrates the inaccuracy of the documentation:
---------------
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect("dbi:Pg:dbname=test");
print "AutoCommit = $dbh->{AutoCommit}\n";
$dbh->do('INSERT INTO foo(x) VALUES (1)');
---------------
The script's output:
AutoCommit = 1
And my PostgreSQL logs (with log_statement = 'all'):
2012-03-05 20:21:02 CST rootLOG: statement: INSERT INTO foo(x) VALUES (1)