Thread: function delete problems

function delete problems

From
Rory Campbell-Lange
Date:
I have made some functions which I wish to remove or remake. These are
'returns opaque' functions that are used for triggers.

I cannot remove them using the drop function <name> command.

obf=> drop function trgpeoplehidden;
ERROR:  parser: parse error at or near ";"

Quoting the function name doesn't seem to help.

What is the best ways of listing, deleting and  updating functions?

(Also, is there a way of seeing what function a trigger on a table
calls? I've tried \d <triggername>).

Thanks for any help
Rory
--
Rory Campbell-Lange
<rory@campbell-lange.net>
<www.campbell-lange.net>

Re: function delete problems

From
Manfred Koizar
Date:
On Tue, 18 Jun 2002 10:14:26 +0100, Rory Campbell-Lange <rory@campbell-lange.net> wrote:
>I have made some functions which I wish to remove or remake. These are
>'returns opaque' functions that are used for triggers.
>
>I cannot remove them using the drop function <name> command.
>
>obf=> drop function trgpeoplehidden;
>ERROR:  parser: parse error at or near ";"

fred=# \h drop function
Command:     DROP FUNCTION
Description: Removes a user-defined C function
Syntax:
DROP FUNCTION name ( [ type [, ...] ] )
                   ^                  ^
                    Don't omit these!

fred=# drop function bla;
ERROR:  parser: parse error at or near ";"
fred=# drop function bla();
ERROR:  RemoveFunction: function 'bla()' does not exist

.. which is correct.

Servus
 Manfred

Re: function delete problems

From
Josh Berkus
Date:
Rory,

Warning: You're about to feel really dumb.  Don't worry, it's happened to me,
too.

> I cannot remove them using the drop function <name> command.
>
> obf=> drop function trgpeoplehidden;
> ERROR:  parser: parse error at or near ";"

That's
DROP FUNCTION trgpeoplehidden();
the parens are mandatory.

You also need to drop the trigger, manually ... dropping the function does not
automatically drop the trigger, though it does break the trigger.

--
-Josh Berkus