Re: Functions and triggers can anyone help

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Functions and triggers can anyone help
Дата
Msg-id 3E4134A9.5080704@joeconway.com
обсуждение исходный текст
Ответ на Functions and triggers can anyone help  (RobertD.Stewart@mail.state.ky.us)
Список pgsql-general
RobertD.Stewart@mail.state.ky.us wrote:
> I'm having a problem with setting up a function and a trigger for one of me
> tables.  I have just started using Postgresql and I'm trying to convert my
> Oracle database over to see how it runs.
>
[...snip...]
>
> And Here is my Postgresql function but when I try to set the trigger it says
> it can't find the function (it does not exist)
>
> CREATE  FUNCTION set_username4(varchar, varchar) RETURNS opaque AS '
>

You haven't provided a complete example, so it's hard to help. One thing I did
notice is that your function is ill-defined if you intend to use it for a
trigger. See:
http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/plpgsql-trigger.html

Quote with emphasis added:
"PL/pgSQL can be used to define trigger procedures. A trigger procedure is
created with the CREATE FUNCTION command as a function with no arguments and a
return type of TRIGGER. Note that the function must be declared with no
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arguments even if it expects to receive arguments specified in CREATE TRIGGER
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--- trigger arguments are passed via TG_ARGV, as described below."

HTH,

Joe


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Functions and triggers can anyone help
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: not exactly a bug report, but surprising behaviour