Tag Info

Hot answers tagged


John is right that the updated syntax error message you get: Msg 1034, Level 15, State 1, Procedure trigger Syntax error: Duplicate specification of the action "UPDATE" in the trigger declaration. This is absolutely because the trigger is specified as FOR UPDATE, UPDATE. This syntax was allowed in older compatibility levels but not in modern ones. ...


The actual syntax for the command shows that there is no such thing as FOR UPDATE, UPDATE - or rather that it just doesn't make any sense: CREATE TRIGGER [ schema_name . ]trigger_name ON { table | view } [ WITH <dml_trigger_option> [ ,...n ] ] { FOR | AFTER | INSTEAD OF } { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] } AS { sql_statement [ ; ...


The TRIGGER can be simplified down to INSERT ... ON DUPLICATE KEY UPDATE ... It is not proper to have "redundant" data in a database. Why can't you just leave it in the original table? When you need it, do a JOIN.


This currently isn't practical. Writes may not be done on a downstream replica, whether it replays WAL via streaming or archives. However, the logical decoding feature in PostgreSQL 9.4 sets the foundations for making this sort of thing possible. You could have a logical decoding plugin that reads the change-stream from the master server, then writes audit ...

Only top voted, non community-wiki answers of a minimum length are eligible