Re: [GENERAL] Shorthand syntax for triggers

2012-10-15 Thread Sergey Konoplev
On Mon, Oct 15, 2012 at 11:36 AM, Moshe Jacobson wrote: >> IF TG_OP = 'DELETE' THEN RENAME OLD TO myrow; >> ELSE RENAME NEW TO myrow; END IF; > > Does the RENAME syntax actually work? My understanding is that it has been > broken for a long time. Oh, you got a point! It does not work since 9.0. I

Re: [GENERAL] Shorthand syntax for triggers

2012-10-15 Thread Moshe Jacobson
On Wed, Oct 10, 2012 at 4:28 PM, Sergey Konoplev 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 myro

Re: [GENERAL] Shorthand syntax for triggers

2012-10-10 Thread Craig Ringer
On 10/11/2012 12:22 AM, Joe Van Dyk wrote: 3. Triggers can access a special CHANGED value that's either NEW for insert or updates, or OLD for deletes. I'm not a big fan of the prior comments about small syntax changes, but this would simplify quite a bit of code. I'd *really* like a way to r

Re: [GENERAL] Shorthand syntax for triggers

2012-10-10 Thread Sergey Konoplev
On Wed, Oct 10, 2012 at 9:22 AM, Joe Van Dyk 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 T