Problems with NEW.* in triggers
| От | Jamie Lawrence |
|---|---|
| Тема | Problems with NEW.* in triggers |
| Дата | |
| Msg-id | 20031104223319.GA2879@clueinc.net обсуждение исходный текст |
| Ответы |
Re: Problems with NEW.* in triggers
Re: Problems with NEW.* in triggers |
| Список | pgsql-sql |
Hi folks - I'm having a problem with what looks like it should be trivial. For the function create or replace function timestamp_fn() returns opaque as ' begin NEW.moddate := coalesce(NEW.moddate, now()); return NEW; end ' language 'plpgsql'; on an after insert or update trigger, never sets moddate to now(). I had thought that if moddate isn't included in an insert or update, that it would be null in the NEW context, so that this would fall through to the now() call. (I also tried this as below: create or replace function timestamp_fn() returns opaque as ' begin if NEW.moddate is not null then returnNEW; else NEW.moddate := now(); return NEW; end if; end ' language 'plpgsql'; With the same results.) Any thoughts on what I'm doing wrong?? -j -- Jamie Lawrence jal@jal.org Never eat anything bigger than your head.
В списке pgsql-sql по дате отправления: