triggers

PostgreSQL Trigger after update of a specific column

我的未来我决定 提交于 2020-12-05 09:14:41
问题 I'm on my way of exploring triggers and want to create one that fires after an Update event on a game_saved column. As I have read in PostgreSQL docs it is possible to create triggers for columns. The column contains boolean values so the user may either add game to his collection or remove it. So I want the trigger function to calculate the number of games set to TRUE in the game_saved column for a certain user. And then update total_game_count in a game_collection table. game_collection id