I've got a tiny problem with how I want this function to work.
On and insert/delete from a table, I want to check to see if a field
contains a certain valule. If it does, not to insert or delete the record.
If it doesn't I want to go ahead and insert/delete the record.
Here's my function.
-- Function: users_upd_del()
CREATE FUNCTION users_upd_del() RETURNS int2 AS 'BEGIN
IF ( NEW.username = ''emsroot'' ) THEN
RAISE NOTICE ''Cannot REMOVE user [ (%) ]'', NEW.username;
RETURN NULL;
END IF;
RETURN 1;
END' LANGUAGE 'plpgsql';
However, when this run I get the error
=== ERROR: fmgr_info: function 696542: cache lookup failed =====
I've tried to change the return type to opaque and remove the RETURN 1; But
if the condition isn't true then I don't have a return.
Can someone help me here, I've looked through the 7.3rc1 Docs shipped with
pgadmin and can't quite see what I'm after...
thanks
Geoff