Re: Patch for - Allow server logs to be remotely read - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Patch for - Allow server logs to be remotely read
Date
Msg-id 200606081415.k58EFEj20094@candle.pha.pa.us
Whole thread Raw
In response to Re: Patch for - Allow server logs to be remotely read  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Bruce Momjian wrote:
> > >
> > > Uh, I just added /contrib/adminpack a few weeks ago to CVS, which does
> > > this, and more.  Sorry I forgot to mark the TODO item as completed.
> >
> > Huh, how do you read files with adminpack?  I only see
> >
> > Datum pg_file_write(PG_FUNCTION_ARGS);
> > Datum pg_file_rename(PG_FUNCTION_ARGS);
> > Datum pg_file_unlink(PG_FUNCTION_ARGS);
> > Datum pg_logdir_ls(PG_FUNCTION_ARGS);
>
> Uh, README.adminpack shows:
>
>     int8 pg_catalog.pg_file_write(fname text, data text, append bool)
>     int8 pg_catalog.pg_file_read(fname text, data text, append bool)
>     bool pg_catalog.pg_file_rename(oldname text, newname text)
>     bool pg_catalog.pg_file_rename(oldname text, newname text, archivname text)
>     bool pg_catalog.pg_file_unlink(fname text)
>     bigint pg_catalog.pg_file_size(text)
>     int4 pg_catalog.pg_logfile_rotate()
>     setof record pg_catalog.pg_logdir_ls()
>
> Is that wrong?  Yes.  Looking at the C file, I see what you mean.  Let
> me update the README.adminpack file.  read_file is already in the
> backend code, and was in 8.1.X too.
>
>     test=> \df *read*
>                               List of functions
>        Schema   |     Name     | Result data type | Argument data types
>     ------------+--------------+------------------+----------------------
>      pg_catalog | loread       | bytea            | integer, integer
>      pg_catalog | pg_read_file | text             | text, bigint, bigint
>     (2 rows)
>
> The unlink part is part of the adminpack.

I see it now.  They do some renaming of functions to match the use by
pgadmin, etc:

    CREATE FUNCTION pg_catalog.pg_file_read(text, bigint, bigint)
    RETURNS text
       AS 'pg_read_file'
            LANGUAGE INTERNAL VOLATILE STRICT;

'pg_file_read' becomes 'pg_read_file.'  Anyway, the read part was
already in the backend, and the unlink part is new in adminpack.


--
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Patch for - Allow server logs to be remotely read
Next
From: Tom Lane
Date:
Subject: Re: Patch for - Allow server logs to be remotely read