| From: | "Evgeni E(dot) Selkov" <selkovjr(at)mcs(dot)anl(dot)gov> | 
|---|---|
| To: | Erich <hh(at)cyberpass(dot)net> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: How to display a user-defined function? (2nd attempt) | 
| Date: | 2000-09-12 08:19:16 | 
| Message-ID: | 200009120819.DAA01389@juju.mcs.anl.gov | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Erich,
This message appears to have been lost, so I am re-sending it. In the
meanwhile, I found that I wasn't up to date on this. While my original
response remains valid, you might also want to check this one out:
http://x61.deja.com/[ST_rn=ps]/getdoc.xp?AN=634046478&CONTEXT=968745179.332202028&hitnum=1
--Gene
----- Original message follows -----
To: Erich <hh(at)cyberpass(dot)net>
cc: pgsql-general(at)postgresql(dot)org
From: selkovjr(at)mcs(dot)anl(dot)gov
Reply-to: selkovjr(at)mcs(dot)anl(dot)gov
Subject: Re: [GENERAL] How to display a user-defined function? 
In-reply-to: <200009061940(dot)MAA21210(at)cyberpass(dot)net> 
References: <200009061940(dot)MAA21210(at)cyberpass(dot)net>
Comments: In-reply-to Erich <hh(at)cyberpass(dot)net>
   message dated "Wed, 06 Sep 2000 12:40:21 -0700."
Date: Wed, 06 Sep 2000 21:04:02 -0500
Sender: selkovjr(at)selkovjr(dot)xnet(dot)com
> I declared a function using CREATE FUNCTION.  Is there a way I can
> display the function back?  I tried \df, etc, but I couldn't figure
> out how to do it.
This feature does not come without some procurement on your part
At the same time when one registers a function, such as
CREATE FUNCTION func(arg, arg, ...) RETURNS ret
        AS 'file' LANGUAGE 'lang';
one also does
INSERT INTO pg_description (objoid, description)
   SELECT oid, 'the function func(arg, arg, ...) does so and so and
returns (ret)'::text
   FROM pg_proc
   WHERE proname = 'func'::name;
Of course, you are also responsible for updating the description
record every time you change or delete your function -- that is, every
time the oid of your function invalidates. It's also nice to let the
users (and yourself a while later) know about the arguments and the
return type of your function.
So when you delete it, you might want to do,
DELETE FROM pg_description 
   WHERE (objoid)
   IN (
     SELECT oid
     FROM pg_proc
     WHERE proname = 'func'::name
   );
DROP FUNCTION func(arg, arg, ...);
Wish it worked sine cura, but it doesn't. Maybe it even shouldn't.
--Gene
> 
> Thanks,
> 
> e
> 
> -- 
> This message was my two cents worth.  Please deposit two cents into
my
> e-gold account by following this link:
> http://rootworks.com/twocentsworth.cgi?102861
> 275A B627 1826 D627 ED35  B8DF 7DDE 4428 0F5C 4454
__
The answer was my goverment's two cents worth. The DOE grant
account DE-FG45-93R530280 has been automatically charged.
Your Tax Cents at Work!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Denis Perchine | 2000-09-12 10:02:57 | Problems inserting data | 
| Previous Message | Gunnar von Boehn | 2000-09-12 07:26:37 | Re: can't read SQL dump from MySQL |