Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-interfaces <pgsql-interfaces(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] ECPG ignores SAVEPOINT if first statement of a transaction
Date: 2005-08-13 15:01:45
Message-ID: 20050813150145.GA87926@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces pgsql-patches

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 15:20:10 Beta time approaching
Previous Message Bruce Momjian 2005-08-13 14:34:43 Re: psql SET/RESET/SHOW tab completion

Browse pgsql-interfaces by date

  From Date Subject
Next Message jing han 2005-08-15 17:03:54 problems about updating a table and cluster this table at the same time
Previous Message William ZHANG 2005-08-13 13:10:46 Re: [BUGS] BUG #1815: ECPGdebug causes crash on Windows XP

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 15:08:39 Re: [HACKERS] For review: Server instrumentation patch
Previous Message Tom Lane 2005-08-13 14:03:03 Re: [HACKERS] For review: Server instrumentation patch