Bird
0
0

How should you rename the triggers to ensure this execution order?

hard📝 Application Q15 of 15
PostgreSQL - Triggers in PostgreSQL
You have three BEFORE DELETE triggers on table customers: clean_up, archive, and notify. You want archive to run first, then clean_up, then notify. How should you rename the triggers to ensure this execution order?
ANo renaming needed; PostgreSQL runs triggers in creation order.
BRename triggers to <code>notify</code>, <code>clean_up</code>, <code>archive</code>.
CRename triggers to <code>a_archive</code>, <code>b_clean_up</code>, <code>c_notify</code>.
DRename triggers to <code>1_archive</code>, <code>2_clean_up</code>, <code>3_notify</code>.
Step-by-Step Solution
Solution:
  1. Step 1: Understand trigger execution order

    PostgreSQL executes triggers in the order they were created for the same event and timing.
  2. Step 2: Renaming triggers does not affect execution order

    Renaming triggers does not change execution order; only creation order matters.
  3. Final Answer:

    No renaming needed; PostgreSQL runs triggers in creation order. -> Option A
  4. Quick Check:

    Trigger order = creation order [OK]
Quick Trick: Trigger execution order depends on creation order, not name [OK]
Common Mistakes:
  • Assuming alphabetical order controls execution
  • Believing numeric or alphabetical prefixes affect order
  • Not understanding creation order importance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes