From: Michael Fuhr <mike@fuhr.org>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: PostgreSQL-interfaces <pgsql-interfaces@postgresql.org>
Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>
Subject: Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction
Date: Sat, 13 Aug 2005 09:01:45 -0600
Message-ID: <20050813150145.GA87926@winnie.fuhr.org> (raw)
In-Reply-To: <200508130222.j7D2MWh29185@candle.pha.pa.us>
References: <20050803153223.GA17861@winnie.fuhr.org>
<200508130222.j7D2MWh29185@candle.pha.pa.us>
On Fri, Aug 12, 2005 at 10:22:32PM -0400, Bruce Momjian wrote:
> Michael Fuhr wrote:
> > ECPG ignores SAVEPOINT if it's the first statement of a transaction:
ECPGtrans() ignores the statement because of this check:
/*
* if we are not in autocommit mode, already have committed the
* transaction and get another commit, just ignore it
*/
if (!con->committed || con->autocommit)
{
if ((res = PQexec(con->connection, transaction)) == NULL)
{
ECPGraise(lineno, ECPG_TRANS, ECPG_SQLSTATE_TRANSACTION_RESOLUTION_UNKNOWN, NULL);
return FALSE;
}
PQclear(res);
}
If no statements have been executed in this transaction then committed
is true, so ECPGtrans() ignores the current statement. It looks
like the code should make an extra consideration for SAVEPOINT in
case it's the first statement.
I'm also wondering if the check for a NULL return value from PQexec()
is sufficient. Shouldn't it also check for a non-NULL result that's
anything other than PGRES_COMMAND_OK?
--
Michael Fuhr
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: mike@fuhr.org, pgman@candle.pha.pa.us, pgsql-patches@postgresql.org
Subject: Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction
In-Reply-To: <20050813150145.GA87926@winnie.fuhr.org>
* 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