Redefine IsTransactionState() to only return true for TRANS_INPROGRESS state,
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Jun 2007 21:45:59 +0000 (21:45 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Jun 2007 21:45:59 +0000 (21:45 +0000)
commit6d6d14b6d52f7a709fba8fd23244a7de014f2048
treeb7785d952d5e841684cdd1054087f63a04bbb009
parent24ee8af57378ee3b065f6a0d62aeb5a5c7313284
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.
src/backend/access/transam/xact.c
src/backend/storage/ipc/procarray.c
src/backend/utils/error/elog.c