Re: [HACKERS] For review: Server instrumentation patch - Mailing list pgsql-patches

From Andreas Pflug
Subject Re: [HACKERS] For review: Server instrumentation patch
Date
Msg-id 42FDA9B8.4070702@pse-consulting.de
Whole thread Raw
In response to Re: [HACKERS] For review: Server instrumentation patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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

pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: createuser patch
Next
From: Marko Kreen
Date:
Subject: Re: [patch 0/7] more patches for pgcrypto