Using OLD on INSERT
От | Paul Makepeace |
---|---|
Тема | Using OLD on INSERT |
Дата | |
Msg-id | 20040122132944.GN26240@mythix.realprogrammers.com обсуждение исходный текст |
Ответы |
Re: Using OLD on INSERT
Re: Using OLD on INSERT |
Список | pgsql-novice |
I have a trigger that sets an expires column to last_access+expiry::interval if expires IS NULL or if the expires value isn't being set or changed. IF NEW.expires IS NULL OR NEW.expires = OLD.expires THEN NEW.expires = NEW.last_access+NEW.expiry:interval; END IF; The problem here is OLD doesn't exist on the first INSERT which throws an error. It seems PL/pgSQL doesn't have C's short-circuit booleans. a) Is there a way around this? b) is there a 'right' way to determine if a column is being changed? Paul (total PL/pgSQL newbie) -- Paul Makepeace ................................ http://paulm.com/ecademy "If I had new shoes, then he wouldn't sing Halleighluha." -- http://paulm.com/toys/surrealism/
В списке pgsql-novice по дате отправления: