Re: handing created and updated fields
| От | Jim C. Nasby |
|---|---|
| Тема | Re: handing created and updated fields |
| Дата | |
| Msg-id | 20050110210516.GC67721@decibel.org обсуждение исходный текст |
| Ответ на | Re: handing created and updated fields (Sven Willenberger <sven@dmv.com>) |
| Список | pgsql-general |
On Mon, Jan 10, 2005 at 11:16:03AM -0500, Sven Willenberger wrote: > These could also be combined into one trigger since they are nearly > identical anyway: > > CREATE FUNCTION combined_trigger() RETURNS TRIGGER AS ' > BEGIN > NEW.update := CURRENT_TIMESTAMP; > IF TG_OP = ''INSERT'' THEN > NEW.created := CURRENT_TIMESTAMP; > ELSE > NEW.created := OLD.created; > END IF; > RETURN NEW; > END; > ' LANGUAGE plpgsql; Excellent; any idea which would perform better (combined v. separate trigger function)? -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"
В списке pgsql-general по дате отправления: