Function problem. - Mailing list pgsql-admin

From Geoff Ellis
Subject Function problem.
Date
Msg-id FDCF842C8B1DD311833C0090277C04B518C359@augusta.planmatics.co.uk
Whole thread Raw
Responses Re: Function problem.
List pgsql-admin
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





pgsql-admin by date:

Previous
From: Christopher McNabb
Date:
Subject: PAM Authentication and Postgresql 7.3
Next
From: "Ing. Gabriel Monsalvo"
Date:
Subject: Re: PAM Authentication and Postgresql 7.3