Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 230e896

Browse files
committed
Make CSV column ordering a bit more logical.
1 parent 1ebff9b commit 230e896

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

doc/src/sgml/config.sgml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.159 2007/12/11 15:19:05 alvherre Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.160 2007/12/11 20:07:31 alvherre Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -3001,7 +3001,7 @@ local0.* /var/log/postgresql
30013001
</row>
30023002
<row>
30033003
<entry><literal>%l</literal></entry>
3004-
<entry>Number of the log line for each process, starting at 1</entry>
3004+
<entry>Number of the log line for each session or process, starting at 1</entry>
30053005
<entry>no</entry>
30063006
</row>
30073007
<row>
@@ -3167,7 +3167,7 @@ local0.* /var/log/postgresql
31673167
provides a convenient way to import log files into a database table.
31683168
This option emits log lines in comma-separated-value format,
31693169
with these columns: timestamp with milliseconds, user name, database
3170-
name, session ID, host:port number, process ID, per-process line
3170+
name, process ID, host:port number, session ID, per-session or -process line
31713171
number, command tag, session start time, virtual transaction ID,
31723172
regular transaction id, error severity, SQL state code, error message,
31733173
error message detail, hint, internal query that led to the error (if
@@ -3181,13 +3181,13 @@ local0.* /var/log/postgresql
31813181
<programlisting>
31823182
CREATE TABLE postgres_log
31833183
(
3184-
log_time timestamp with time zone,
3184+
log_time timestamp(3) with time zone,
31853185
user_name text,
31863186
database_name text,
3187-
session_id text,
3188-
connection_from text,
31893187
process_id integer,
3190-
process_line_num bigint,
3188+
connection_from text,
3189+
session_id text,
3190+
session_line_num bigint,
31913191
command_tag text,
31923192
session_start_time timestamp with time zone,
31933193
virtual_transaction_id text,
@@ -3203,7 +3203,7 @@ CREATE TABLE postgres_log
32033203
query text,
32043204
query_pos integer,
32053205
location text,
3206-
PRIMARY KEY (session_id, process_line_num)
3206+
PRIMARY KEY (session_id, session_line_num)
32073207
);
32083208
</programlisting>
32093209
</para>

src/backend/utils/error/elog.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.199 2007/12/11 15:19:05 alvherre Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.200 2007/12/11 20:07:31 alvherre Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1667,7 +1667,6 @@ write_csvlog(ErrorData *edata)
16671667

16681668
initStringInfo(&buf);
16691669

1670-
16711670
/*
16721671
* timestamp with milliseconds
16731672
*
@@ -1715,8 +1714,9 @@ write_csvlog(ErrorData *edata)
17151714
appendCSVLiteral(&buf, MyProcPort->database_name);
17161715
appendStringInfoChar(&buf, ',');
17171716

1718-
/* session id */
1719-
appendStringInfo(&buf, "%lx.%x", (long) MyStartTime, MyProcPid);
1717+
/* Process id */
1718+
if (MyProcPid != 0)
1719+
appendStringInfo(&buf, "%d", MyProcPid);
17201720
appendStringInfoChar(&buf, ',');
17211721

17221722
/* Remote host and port */
@@ -1730,9 +1730,8 @@ write_csvlog(ErrorData *edata)
17301730
}
17311731
appendStringInfoChar(&buf, ',');
17321732

1733-
/* Process id */
1734-
if (MyProcPid != 0)
1735-
appendStringInfo(&buf, "%d", MyProcPid);
1733+
/* session id */
1734+
appendStringInfo(&buf, "%lx.%x", (long) MyStartTime, MyProcPid);
17361735
appendStringInfoChar(&buf, ',');
17371736

17381737
/* Line number */

0 commit comments

Comments
 (0)