pgsql: Redefine IsTransactionState() to only return true for

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Redefine IsTransactionState() to only return true for
Date: 2007-06-07 21:46:00
Message-ID: 20070607214600.5BADA9FB919@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Redefine IsTransactionState() to only return true for TRANS_INPROGRESS state,
which is the only state in which it's safe to initiate database queries.
It turns out that all but two of the callers thought that's what it meant;
and the other two were using it as a proxy for "will GetTopTransactionId()
return a nonzero XID"? Since it was in fact an unreliable guide to that,
make those two just invoke GetTopTransactionId() always, then deal with a
zero result if they get one.

Modified Files:
--------------
pgsql/src/backend/access/transam:
xact.c (r1.244 -> r1.245)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xact.c.diff?r1=1.244&r2=1.245)
pgsql/src/backend/storage/ipc:
procarray.c (r1.25 -> r1.26)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/ipc/procarray.c.diff?r1=1.25&r2=1.26)
pgsql/src/backend/utils/error:
elog.c (r1.185 -> r1.186)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/error/elog.c.diff?r1=1.185&r2=1.186)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2007-06-07 22:09:36 Re: [COMMITTERS] pgsql: Avoid losing track of data for shared tables in pgstats.
Previous Message Gregory Stark 2007-06-07 21:07:03 Re: [COMMITTERS] pgsql: Avoid losing track of data for shared tables in pgstats.