Hot answers tagged trigger
Since it's only UPDATE,INSERT you can say: IF EXISTS (SELECT 1 FROM deleted) -- update ELSE -- insert You have a bigger problem, though. There is no such thing as new.Id, and an insert or update can affect multiple rows (in some platforms, triggers fire per row; in SQL Server, they fire per operation). So you need to either: Use a loop to call the ...
Regular trigger will see changes made in other tables within the same transaction. However, if you create the trigger (or other programmable object) with PRAGMA AUTONOMOUS_TRANSACTION, it will be executed within the scope of new transaction and won't be able to see "parent" transaction changes.
I got some interesting news for you. You cannot use information_schema.tables because it does not track changes to InnoDB tables. The best way to find out when a table changed is to go to the OS and get the most recent timestamp of each table. Rather than plagiarize my own posts, here are my posts where I show you how to do this Sep 25, 2014 : want to ...
What you are doing is impossible because the INFORMATION_SCHEMA database is a database made up of in-memory read-only temporary tables (See my post How is INFORMATION_SCHEMA implemented in MySQL?) You are going to have to drop the triggers and recreate them I wrote a post on that before (Oct 02, 2011 : Can mysqldump dump triggers and procedures?) Here is ...
The behaviour you've described is correct and documented : http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS If the trigger have been created with double quote and special char, it must be used with the same syntax.
Only top voted, non community-wiki answers of a minimum length are eligible