Re: Patch to implement pg_current_logfile() function - Mailing list pgsql-hackers

From Gilles Darold
Subject Re: Patch to implement pg_current_logfile() function
Date
Msg-id be9571dc-ae7c-63d4-6750-d7243cb5fbc0@dalibo.com
Whole thread Raw
In response to Re: Patch to implement pg_current_logfile() function  (Christoph Berg <myon@debian.org>)
Responses Re: Patch to implement pg_current_logfile() function  (Christoph Berg <myon@debian.org>)
List pgsql-hackers
<div class="moz-cite-prefix">Le 14/10/2016 à 18:50, Christoph Berg a écrit :<br /></div><blockquote
cite="mid:20161014165007.bzbuzeklsvcr3swh@msg.df7cb.de"type="cite"><pre wrap="">Re: To Gilles Darold 2016-10-14 <a
class="moz-txt-link-rfc2396E"
href="mailto:20161014125406.albrfj3qldiwjnrr@msg.df7cb.de"><20161014125406.albrfj3qldiwjnrr@msg.df7cb.de></a>
</pre><blockquote type="cite"><pre wrap="">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
</pre></blockquote><blockquote type="cite"><pre wrap="">(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.logcsvlog |
pg_log/postgresql-2016-10-07_1646.csv
</pre></blockquote><pre wrap="">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.
</pre></blockquote><br /><p>Agree, the usability of the current version is really a pain. What I've thought is that the
functioncould return the csv log in all case when csvlog is set in log_destination and the stderr log file when csvlog
isnot defined. We can also have a parametrer to ask for a specific log format, like pg_current_logfile('csv') or
pg_current_logfile('stderr').<preclass="moz-signature" cols="72">-- 
 
Gilles Darold
Consultant PostgreSQL
<a class="moz-txt-link-freetext" href="http://dalibo.com">http://dalibo.com</a> - <a class="moz-txt-link-freetext"
href="http://dalibo.org">http://dalibo.org</a>
</pre>

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: signal handling in plpython
Next
From: Christoph Berg
Date:
Subject: Re: Patch to implement pg_current_logfile() function