-----Original Message-----
From: Stuart Foster <stuartafoster@home.com>
To: PG-SQL <pgsql-sql@postgresql.org>
Date: Wednesday, 30 August 2000 2:25
Subject: [SQL] Viewing a function
Helllo Stuart,
Good question.
I have been fiddly with a function editor using zeos controls and I have
lots of little problems, so that I have given up for a while.
I successfully parsed function information. (The following is from memory
and I dont have postgres with me right now).
The body of the function is in pg_lang.prosrc (I think) or something like
that
(I found out most stuff by looking in the c code for psql. I work in
delphi)
You can work out param numbers from another field and work out the field
types(I confess Icheated here. You can get field type out of system tables but I
never actually worked out how).
I could reconstruct a nice looking create function string using data in the
data base.
When I tried it execute things from windows things went wrong but it work in
psql.
I ended up just using it as a utility to create separated create function
files wich I then loaded server side.
Anyway... then problems.
I dont think I ever had a successful update from client side.
Once I committed a change I often could not successfully drop and create a
function and vacuum would fail.
To recover I had to drop all functions and re-create them.
Using PERFORM seemed to cause particular problems. (Think that anything
that is called by perform must be compiled in before anything that calls it.
Order of creation seems to important. A full dump and create would fix
these sort of problems)
The cr/lf thing also gave problems although I wrote what I thought was a
client side fix for this.
You can have my source in Delphi (such as it is) if you are interested.
I think there must be flags or dependencies with function managemnt which I
dont understand.
PS I have not had success editing function in pgaccess either (similar
problems)
A simple way to view functions is pg_dump -c -s database to just dump schema
and drop statements. Cut and paste function definitions.
The difficulty of function editing has retarded my putting tasks server-side
which belong there.
>How can a view a function after it's created ?
>I've created a SQL function that I need to review and possibly change. What
>is the best way to go about this.
>
>
>TIA
>
Another stuart