Re: pl/{perl,pgsql} (was Re: AW: [HACKERS] triggers, views and ru - Mailing list pgsql-hackers

From jwieck@debis.com (Jan Wieck)
Subject Re: pl/{perl,pgsql} (was Re: AW: [HACKERS] triggers, views and ru
Date
Msg-id m0y74ow-000BFRC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: pl/{perl,pgsql} (was Re: AW: [HACKERS] triggers, views and ru  (ocie@paracel.com)
Responses Re: pl/{perl,pgsql} (was Re: AW: [HACKERS] triggers, views and ru  (Brett McCormick <brett@work.chicken.org>)
List pgsql-hackers
Ocie Mitchell wrote:
>
> Jan Wieck wrote:
> > > BTW.: How do you write an input or output function in pl/tcl if all you get
> > > is the external representation ?
> >
> >     Impossible.
>
> We could have the backend check file permissions, open the file and
> pass the file pointer to the pl/tcl procedure.  This sounds a bit
> complicated I know.  It seems to me that we would want at least a
> "stdout" available to the procedure so that it can "talk to" the user.
> If we provide stdin, stdout and stderr, then we could use redirection
> to pipe input to and from a procedure.

    That's  not  the  point.  With  input/output  functions,  the
    postgres data types input/output registered procedures  where
    ment.  That  are  the  functions, that convert one Datum from
    it's external string representation into and back  from  it's
    internal binary value used in the database tuples.

    Direct  file  access  from inside a backends function is IMHO
    never a good  thing.  This  is  the  job  of  an  application
    program,  because  the  actually accessed file might be on an
    NFS filesystem, this can hang and the database  backend  will
    hang inside of a transaction where maybe even the DBA or root
    cannot kill them (process is blocked inside a system call).

    This is IMHO a NONO.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: Henry Spencer
Date:
Subject: Re: Appended a string of text to each line in a file
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: [COMMITTERS] 'pgsql/src/bin/initdb initdb.sh'