Created
June 15, 2012 14:54
-
-
Save jlee42/2936854 to your computer and use it in GitHub Desktop.
Blackboard Transact Unix - PostgreSQL Triggers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Create a function to preform the timestamp update. | |
| CREATE OR REPLACE FUNCTION update_updated_at_column() | |
| RETURNS TRIGGER AS $$ | |
| BEGIN | |
| NEW.updated_at = now(); | |
| RETURN NEW; | |
| END; | |
| $$ language 'plpgsql'; | |
| -- Create a trigger to run this function prior to an UPDATE on a row. | |
| CREATE TRIGGER update_vidimg_updated_at_time BEFORE UPDATE ON vidimg FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment