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?"