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
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to