Re: Trigger Documentation

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Trigger Documentation
Дата
Msg-id 20010610093544.14c48d82.depesz@depesz.pl
обсуждение исходный текст
Ответ на Trigger Documentation  (al_nunes@ciclotecnologia.com.br)
Список pgsql-docs
On Fri, 8 Jun 2001 11:55:08 -0300 (BRT)
al_nunes@ciclotecnologia.com.br wrote:

> What I need to do now is very simple, I want to make a trigger that
check
> if some text field is null. If it is, I want to record something on
> it. What I was trying (unsuccessfully):
> CREATE FUNCTION ins_ip() RETURNS OPAQUE AS '
> BEGIN
>  IF NEW.<field> ISNULL THEN
>   NEW.<field> := "something";
>    RETURN NEW;
> END;

you're missing two things.
1st. there should be end if
2nd. is should be NEW.<field> := ''something'';

btw. it's better to do it with "DEFAULT" statement in create table.

depesz

--
hubert depesz lubaczewski                          http://www.depesz.pl/
------------------------------------------------------------------------
     najwspanialszą rzeczą jaką dało nam nowoczesne społeczeństwo,
      jest niesamowita wręcz łatwość unikania kontaktów z nim ...

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Update needed for documentation
Следующее
От: Constantin Teodorescu
Дата:
Сообщение: Re: [INTERFACES] Lots of obsolete docs in pgaccess/lib/help