Function problem.

From: "Geoff Ellis" <geoff(at)metalogicplc(dot)com>
To: "Pgsql-Admin (E-mail)" <pgsql-admin(at)postgresql(dot)org>
Subject: Function problem.
Date: 2003-01-13 15:05:08
Message-ID: FDCF842C8B1DD311833C0090277C04B518C359@augusta.planmatics.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ing. Gabriel Monsalvo 2003-01-13 15:13:21 Re: PAM Authentication and Postgresql 7.3
Previous Message Christopher McNabb 2003-01-13 14:59:04 PAM Authentication and Postgresql 7.3