From: Karl DeBisschop <kdebisschop@range.infoplease.com>
To: pgsql-hackers@postgreSQL.org
To: pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Re: [HACKERS] TRANSACTIONS
Date: Thu, 24 Feb 2000 14:16:05 -0500
Message-ID: <200002241916.OAA07901@skillet.infoplease.com> (raw)
In-Reply-To: <38B57564.46BB28C0@mindspring.com>
References: <38B27760.DB921B57@sferacarta.com>
<23935.951237171@sss.pgh.pa.us>
<38B3E365.D2B61959@sferacarta.com>
<200002231516.KAA23839@skillet.infoplease.com>
<38B57564.46BB28C0@mindspring.com>
To summarize, I stated that the following does not work with
postgresql:
> $dbh->{AutoCommit} = 0;
> $dbh->do("CREATE TABLE tmp (a int unique,b int)");
> while (<>){
> if (/([0-9]+) ([0-9]+)/) {
> $rtv = $dbh->do("INSERT INTO tmp VALUES ($1,$2)");
> if ($rtv) {$dbh->do("UPDATE tmp SET b=$2 where a=$1")};
> }
> }
> $dbh->commit;
> $dbh->disconnect;
I further said that regardless of what the SQL standard gurus decide,
I felt that postgresql currently gives desirable behavior - once a
transaction is started, it's either all or nothing. But then I
qualified that by saying I'd like somehow to be able to "sanitize" the
transaction so that the common idiom above could be made to work.
From my examination, the difference between our two examples is
Original:
KD> $rtv = $dbh->do("INSERT INTO tmp VALUES ($1,$2)");
Modified:
KM> eval{$rtv = $dbh->do("INSERT INTO tmp VALUES ($1,$2)")};
From the point of view if the DBMS, i believe these are identical - in
both cases the query is issued to the DMBS and the overall transaction
becomes "contaminated". And as I said before, this is exactly what
I'd like to have happen in the default case.
It's not that eval's error trapping is blown out - it's that the
transaction defined by the AutoCommit cannot complete because a part
of it cannot complete -- that's what atomicity means.
At least that's the way it looks to me. But as I started out saying,
I don't feel qualified to interpret the standard - I might be wrong,
plain and simple.
--
Karl DeBisschop <kdebisschop@alert.infoplease.com>
617.832.0332 (Fax: 617.956.2696)
Information Please - your source for FREE online reference
http://www.infoplease.com - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper
Netsaint Plugins Development
http://netsaintplug.sourceforge.net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: kdebisschop@range.infoplease.com, pgsql-hackers@postgreSQL.org
Subject: Re: [GENERAL] Re: [HACKERS] TRANSACTIONS
In-Reply-To: <200002241916.OAA07901@skillet.infoplease.com>
References: <38B27760.DB921B57@sferacarta.com> <23935.951237171@sss.pgh.pa.us> <38B3E365.D2B61959@sferacarta.com> <200002231516.KAA23839@skillet.infoplease.com> <38B57564.46BB28C0@mindspring.com> <200002241916.OAA07901@skillet.infoplease.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox