Re: [HACKERS] For review: Server instrumentation patch

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Subject: Re: [HACKERS] For review: Server instrumentation patch
Date: 2005-08-13 08:05:12
Message-ID: 42FDA9B8.4070702@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:

>
> True, but that is more for the application. I don't imagine a user
> looking at that from psql would have a problem.
>
> However, you asked for a query that looks like pg_ls_logdir() and here
> it is:
>
> SELECT pg_ls_dir
> FROM (
> SELECT pg_ls_dir(t1.setting)
> FROM (SELECT setting FROM pg_settings WHERE NAME = 'log_directory') AS t1
> ) AS t2,
> (SELECT setting FROM pg_settings WHERE NAME = 'log_filename') AS t3
> WHERE t2.pg_ls_dir LIKE regexp_replace(t3.setting, '%.*', '') || '%';
>
> The one thing it doesn't do, as you mentioned, is check for valid dates,
> but it is certainly more flexible than embedding something in the backend.

The interesting part of pg_logdir_ls is the filetime, to enable

SELECT pg_file_unlink(filename)
FROM pg_logdir_ls()
WHERE filetime < now() - '30 days'::interval

Regards,
Andreas

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Marko Kreen 2005-08-13 09:00:08 Re: [patch 0/7] more patches for pgcrypto
Previous Message Brendan Jurd 2005-08-13 06:30:03 Re: gettime() - a timeofday() alternative