Re: Add support for logging the current role

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add support for logging the current role
Date: 2011-02-01 11:48:30
Message-ID: AANLkTikfqO78LZ8uECHTJhoGLshf=6yYxVO+Dfiu60on@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Updated patch attached.

I think we need to improve postgresql.conf.sample a bit more, especially
the long line for #log_csv_fields = '...'. 330 characters in it!
#1. Leave the long line because it is needed.
#2. Hide the variable from the default conf.
#3. Use short %x mnemonic both in log_line_prefix and log_csv_fields.
(It might require many additional mnemonics.)
Which is better, or another idea?

On Sat, Jan 29, 2011 at 13:06, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> * log_csv_fields's GUC context is PGC_POSTMASTER. Is it by design?
>
> Doing SIGHUP would require addressing how to get all of the backends to
> close the old log file and open the new one, because we don't want to
> have a given log file which has two different CSV formats in it (we
> wouldn't be able to load it into the database...).  This was
> specifically addressed in the thread leading up to this patch...

I think it depends default log filename, that contains %S (seconds)
suffix. We can remove %S from log_filename; if we use a log per-day,
those log might contain different columns even after restart. If we
cannot avoid zigged csv fields completely, SIGHUP seems reasonable for it.

>> * What objects do you want to allocate in TopMemoryContext in
>> assign_log_csv_fields() ?
> I just moved the switch to Top to be after those are allocated.

How about changing the type of csv_log_fields from List* to fixed
array of LogCSVFields? If so, we can use an array-initializer
instead of build_default_csvlog_list() ? The code will be simplified.
Fixed length won't be a problem because it would be rare that the
same field are specified many times.

>> * Docs need some tags for itemized elements or pre-formatted codes.
>>   They looks itemized in the sgml files, but will be flattened in
>>   complied HTML files.
>
> Not sure what you're referring to here...?  Can you elaborate?  I'm not
> great with the docs. :/

Could you try to "make html" in the doc directory?
Your new decumentation after
| These columns may be included in the CSV output:
will be unaligned plain text without some tags.

--
Itagaki Takahiro

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2011-02-01 12:28:59 Re: Transaction-scope advisory locks
Previous Message Dave Page 2011-02-01 11:08:38 Re: setlocale and gettext in Postgres