On Wed, Oct 10, 2012 at 9:22 AM, Joe Van Dyk <joe@xxxxxxxxx> wrote: > I wish I could do: > > create trigger some_trigger after insert on products > execute procedure do $$ begin > insert into audits values (CHANGED.value); > end $$ language plpgsql; IF TG_OP = 'DELETE' THEN RENAME OLD TO myrow; ELSE RENAME NEW TO myrow; END IF; and then use insert into audits values (myrow.value); > > > Changes/improvements: > > 1. Triggers default to 'for each row' > > 2. Triggers can use anonymous functions > > 3. Triggers can access a special CHANGED value that's either NEW for insert > or updates, or OLD for deletes. > > 4. Default for 'after insert' triggers is to return null, as I believe it > doesn't matter what you return here. > > 5. Way less repetitive typing. > > > Thoughts? Is this a terrible idea? -- Sergey Konoplev a database and software architect http://www.linkedin.com/in/grayhemp Jabber: gray.ru@xxxxxxxxx Skype: gray-hemp Phone: +14158679984 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general