Mike Ginsburg <mginsb...@collaborativefusion.com> wrote:

> [...]
> Thanks for the help!  I'll look into the exceptions to see
> how expensive they are.  On a related note, I was just told
> by our sysadmins that pg 8.4 might not be installed by the
> time this needs to be rolled out, leaving me in a bind since
> I have been using "EXECUTE ... USING" queries.  A sample of
> my trigger is below:

>  FOR colRow IN SELECT attname FROM pg_catalog.pg_attribute
> WHERE attnum
>> 0 AND attrelid = TG_RELID LOOP
>      EXECUTE 'SELECT ($1).' || colRow.attname || '::text' INTO n USING NEW;
>      EXECUTE 'SELECT ($1).' || colRow.attname || '::text' INTO o USING OLD;
>      IF n <> o THEN
>        q := 'INSERT INTO change_log (...) VALUES (...);
>        EXECUTE q;
>      END IF;
>    END LOOP;

> Any insight on a way I can grab NEW.(colRow.attname) without EXECUTE USING?

Wouldn't it be *much* easier to just have /two/ trigger
functions? Your "editor" columns probably don't pop up and
disappear randomly.

Tim


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to