Re: logfile subprocess and Fancy File Functions

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: logfile subprocess and Fancy File Functions
Date: 2004-07-21 10:04:03
Message-ID: 40FE3F93.2060308@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:
> Andreas Pflug wrote:
>

>
>
> OK, new idea. Forget about modifying pg_dir_ls(). Instead add
> pg_file_stat the returns the file size, times. You can then easily use
> that for file size and times. Also, if you want, add an is_dir boolean
> so people can write functions that walk the directory tree.

I now replaced pg_logfile_length, instead pg_logfile_stat(text) will
return a record (len int8, ctime timestamp, atime timestamp, mtime
timestamp, isdir bool).

For convenience, I'd like to have the function

CREATE FUNCTION pg_file_length(text) RETURNS int8
AS
$BODY$
SELECT len
FROM pg_file_stat($1) AS stat
(len int8, ctime timestamp,
atime timestamp, mtime timestamp, isdir bool)
$BODY$ LANGUAGE SQL STRICT;

Where is the right place to put it?

Also, I wonder how to join pg_file_stat and pg_dir_ls to get a ls -l
like listing. Apparently I can't do that, unless I don't code pg_dir_ls
as returning records too, right?

>
> I noticed we had a big logging discussion during 7.4 beta about logging
> and log rotation. This patch is clearly superior to the ideas we had at
> that time.
>

Currently, the discussion circles around file functions, not logging. If
you think that part is clean, how about committing it separately so it
can be tested/used (no problem if pg_logfile_rotate() isn't available
right from the start). I'll supply docs RSN.

Regards,
Andreas

Attachment Content-Type Size
logfile.diff text/x-patch 27.8 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Mark Cave-Ayland 2004-07-21 10:38:14 Re: win32 readline
Previous Message Magnus Hagander 2004-07-21 08:13:06 Re: win32 readline