diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 21:45:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 21:45:59 +0000 |
commit | 6d6d14b6d52f7a709fba8fd23244a7de014f2048 (patch) | |
tree | b7785d952d5e841684cdd1054087f63a04bbb009 /src/backend/utils/error/elog.c | |
parent | 24ee8af57378ee3b065f6a0d62aeb5a5c7313284 (diff) |
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.
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r-- | src/backend/utils/error/elog.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 93e7663da3a..c6952ef20e8 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -42,7 +42,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.185 2007/05/04 02:01:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.186 2007/06/07 21:45:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1593,12 +1593,7 @@ log_line_prefix(StringInfo buf) break; case 'x': if (MyProcPort) - { - if (IsTransactionState()) - appendStringInfo(buf, "%u", GetTopTransactionId()); - else - appendStringInfo(buf, "%u", InvalidTransactionId); - } + appendStringInfo(buf, "%u", GetTopTransactionId()); break; case '%': appendStringInfoChar(buf, '%'); |