COPY-able sql log outputs

From: "FAST PostgreSQL" <fastpgs(at)fast(dot)fujitsu(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: COPY-able sql log outputs
Date: 2007-04-03 18:33:14
Message-ID: 21558.10091175247187.fast.fujitsu.com.au@MHS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi,

Attached is the completed patch for the COPY-able sql log outputs. I have
modified my previous WIP patch, incorporating all the changes requested by
the community. This patch has been tested both on windows and linux.

Reiterating what has been done.

The log is now output in COPY-able format as suggested. (Not INSERT-able as
was in the previous WIP patch.)

log_destination now accepts 'sqllog' as a valid output destination. The log
output file will be determined by pg_log and log_filename variables. The sql
log output filename will be 'log_filename'.sql. The file rotation rules apply
to the sql log file output as well.

The log output format is as follows.

timestamp, username, database_name, sessionid, host_port, process_id,
command_tag, session_start_time, transaction_id, error_severity,
sql_state_code, statement

The logs can be loaded into a table using the command

COPY sqltable FROM 'filename.sql' WITH CSV;

There are only two minor issues I can think of
1. The sql log is currently output with newline and tab characters. It loads
into the table neatly. No problems. But when read back, atleast from psql in
windows, the tabs are replaced with some special characters.

2. I think it is better to document somewhere the table structure and the
COPY statement above. But where?

[P.S. - In the wake of community's concerns regarding the legal disclaimer
getting attached to the end of mails we send to the community, we have got an
exemption from the disclaimer getting attached. As this is the first mail I
am sending after this approval, fingers crossed, it works. If for some reason
it gets attached, please ignore this mail and I will send the patch from some
other account.]

Rgds,
Arul Shaji

Attachment Content-Type Size
sqllog.patch text/x-diff 47.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message FAST PostgreSQL 2007-04-03 18:58:42 Fwd: Re: [pgsql-patches] pg_get_domaindef
Previous Message stark 2007-04-03 18:30:50 Doc patch for create index