Re: Patch to implement pg_current_logfile() function

From: Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>, "Karl O(dot) Pinc" <kop(at)meme(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to implement pg_current_logfile() function
Date: 2016-10-14 18:25:50
Message-ID: be9571dc-ae7c-63d4-6750-d7243cb5fbc0@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Le 14/10/2016 à 18:50, Christoph Berg a écrit :
> Re: To Gilles Darold 2016-10-14 <20161014125406(dot)albrfj3qldiwjnrr(at)msg(dot)df7cb(dot)de>
>> A better design might be to return two columns instead:
>>
>> postgres=# select * from pg_current_logfile();
>> stderr | csvlog
>> ---------------------------------------+---------------------------------------
>> pg_log/postgresql-2016-10-07_1646.log | pg_log/postgresql-2016-10-07_1646.csv
>> (The alternative could be to return an extra column:
>>
>> postgres=# select * from pg_current_logfile();
>> type | logfile
>> ---------------------------------------
>> stderr | pg_log/postgresql-2016-10-07_1646.log
>> csvlog | pg_log/postgresql-2016-10-07_1646.csv
> Usability-wise it might be better to have pg_current_logfile() just
> return the name of the text log (and possibly a HINT that there's a
> csv log if stderr is disabled), and have a second function
> pg_current_csvlog() return the csv log name.
>
> The choice which design is better will probably depend on if we think
> these functions are meant for interactive use (-> 2 functions), or for
> automated use (-> 2 columns). My guess would be that interactive use
> is more important here.

Agree, the usability of the current version is really a pain. What I've
thought is that the function could return the csv log in all case when
csvlog is set in log_destination and the stderr log file when csvlog is
not defined. We can also have a parametrer to ask for a specific log
format, like pg_current_logfile('csv') or pg_current_logfile('stderr').

--
Gilles Darold
Consultant PostgreSQL
http://dalibo.com - http://dalibo.org

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2016-10-14 18:45:14 Re: Patch to implement pg_current_logfile() function
Previous Message Tom Lane 2016-10-14 18:08:39 Re: signal handling in plpython