From the course: Advanced PostgreSQL

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Trigger execution order

Trigger execution order - PostgreSQL Tutorial

From the course: Advanced PostgreSQL

Trigger execution order

What if you have both row-level and statement level triggers and these triggers are configured before, after or instead of an operation? In this movie, we'll try and understand in what order these trigger functions will be invoked. Let's consider the operation first. The operation can be an insert, update or delete operation. And you could configure a statement level trigger to be invoked before the operation or after the operation. You could also configure row-level triggers for functions to be invoked before the operation or after the operation. And if you're configuring this trigger on a view, you could have a row-level instead of trigger. Now, what's the order for these? Let's take a look. This is the order in which statement level and row-level before and after trigger functions will be invoked. The statement level before function will be invoked before the row-level before function and the row-level after function will be invoked before the statement level after function…

Contents