Function problem.

Поиск
Список
Период
Сортировка
От Geoff Ellis
Тема Function problem.
Дата
Msg-id FDCF842C8B1DD311833C0090277C04B518C359@augusta.planmatics.co.uk
обсуждение исходный текст
Ответы Re: Function problem.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Christopher McNabb
Дата:
Сообщение: PAM Authentication and Postgresql 7.3
Следующее
От: "Ing. Gabriel Monsalvo"
Дата:
Сообщение: Re: PAM Authentication and Postgresql 7.3