From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de> |
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-22 03:20:48 |
Message-ID: | 200407220320.i6M3Kmr15348@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Andreas Pflug wrote:
> > or something like that. However, I don't think you can have a function
> > call returning multiple values in the target list, and I can't figure
> > out how to pass an argument to the function if it is in the target list.
> > Ideas?
>
> I thought of
> SELECT filename, len, ctime
> FROM pg_dir_ls('/etc') AS d (filename text...)
> JOIN pg_file_stat(filename) AS s(len int8, ....)
> WHERE filename like 's%'
>
> but that wouldn't work either.
>
> Hm, is it really worth thinking about this further. We won't contribute
> a Konqueror plugin to browse a file server through a pgsql connection, I
> believe...
Here is what you can do:
SELECT filename,
(SELECT file_len FROM pg_file_stat(filename)),
(SELECT file_ctime FROM pg_file_stat(filename)),
(SELECT file_mtime FROM pg_file_stat(filename)),
(SELECT file_atime FROM pg_file_stat(filename))
FROM pg_dir_ls('/etc') AS d (filename text...)
WHERE filename like 's%'
I don't think you can have a subquery in the target list that returns
more the one column so you have to do multiple SELECT calls.
> >>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.
> >
> >
> > Is pg_logfile_rotate() not working? You mean pg_file_length().
>
> pg_logfile_rotate() *is* working, it's just buried in a bunch of generic
> file functions in adt/misc.c. My suggestion was to commit without
> pg_proc.h, builtins.h and misc.c. For automatic logfile rotation, no
> function is needed.
> I now separated the generic file functions in a separate file
> misc/adt/genfile.c. syslogger.c/h are still unchanged, appended for
> convenience.
No. We will have enough time for testing. Let's get this right first.
If we leave it for later we will forget.
Are we done? Seems pg_file_stat() works fine. Do we need other
adjustments?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-07-22 03:29:08 | Re: [HACKERS] Point in Time Recovery |
Previous Message | Mark Kirkwood | 2004-07-22 03:12:21 | Re: [HACKERS] Point in Time Recovery |