Обсуждение: pgsql: Redefine IsTransactionState() to only return true for
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)