Commit a3c53c83 authored by Neil Conway's avatar Neil Conway

This patch from Alvaro Herrera adds transaction ID to the list of

log_line_prefix escapes. The escape sequence used for this is %x.
%x previously meant "postmaster et al. stop here" -- this has been
renamed to %q.
parent 665d3736
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.281 2004/09/17 22:40:46 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.282 2004/09/22 03:55:24 neilc Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -2394,6 +2394,11 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32 ...@@ -2394,6 +2394,11 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32
</row> </row>
<row> <row>
<entry><literal>%x</literal></entry> <entry><literal>%x</literal></entry>
<entry>Transaction ID</entry>
<entry>Yes</entry>
</row>
<row>
<entry><literal>%q</literal></entry>
<entry>Does not produce any output, but tells non-session <entry>Does not produce any output, but tells non-session
processes to stop at this point in the string. Ignored by processes to stop at this point in the string. Ignored by
session processes.</entry> session processes.</entry>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.150 2004/09/05 03:42:11 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.151 2004/09/22 03:55:26 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1421,12 +1421,21 @@ log_line_prefix(StringInfo buf) ...@@ -1421,12 +1421,21 @@ log_line_prefix(StringInfo buf)
MyProcPort->remote_port); MyProcPort->remote_port);
} }
break; break;
case 'x': case 'q':
/* in postmaster and friends, stop if %x is seen */ /* in postmaster and friends, stop if %q is seen */
/* in a backend, just ignore */ /* in a backend, just ignore */
if (MyProcPort == NULL) if (MyProcPort == NULL)
i = format_len; i = format_len;
break; break;
case 'x':
if (MyProcPort)
{
if (IsTransactionState())
appendStringInfo(buf, "%u", GetTopTransactionId());
else
appendStringInfo(buf, "%u", InvalidTransactionId);
}
break;
case '%': case '%':
appendStringInfoChar(buf, '%'); appendStringInfoChar(buf, '%');
break; break;
......
...@@ -231,8 +231,8 @@ ...@@ -231,8 +231,8 @@
# %r=remote host and port # %r=remote host and port
# %p=PID %t=timestamp %i=command tag # %p=PID %t=timestamp %i=command tag
# %c=session id %l=session line number # %c=session id %l=session line number
# %s=session start timestamp # %s=session start timestamp %x=transaction id
# %x=stop here in non-session processes # %q=stop here in non-session processes
# %%='%' # %%='%'
#log_statement = 'none' # none, mod, ddl, all #log_statement = 'none' # none, mod, ddl, all
#log_hostname = false #log_hostname = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment