Bird
0
0

You have two AFTER UPDATE triggers on table products: zeta_trigger and alpha_trigger. You want zeta_trigger to run before alpha_trigger. What is the problem with this setup?

medium📝 Debug Q14 of 15
PostgreSQL - Triggers in PostgreSQL
You have two AFTER UPDATE triggers on table products: zeta_trigger and alpha_trigger. You want zeta_trigger to run before alpha_trigger. What is the problem with this setup?
ATriggers run in reverse alphabetical order, so <code>zeta_trigger</code> runs first as desired.
BPostgreSQL does not support multiple triggers on the same event.
CYou must rename triggers to numbers to control order.
DPostgreSQL runs triggers alphabetically, so <code>alpha_trigger</code> runs before <code>zeta_trigger</code> regardless of creation order.
Step-by-Step Solution
Solution:
  1. Step 1: Understand trigger execution order

    PostgreSQL executes multiple triggers for the same event and timing in the order they were created.
  2. Step 2: Analyze the trigger names

    Trigger names do not affect execution order; creation order does. So the trigger created first runs first.
  3. Final Answer:

    PostgreSQL runs triggers in creation order, so alpha_trigger runs before zeta_trigger if created first. -> Option D
  4. Quick Check:

    Trigger order = creation order [OK]
Quick Trick: Creation order controls trigger execution, not alphabetical order [OK]
Common Mistakes:
  • Assuming creation order controls execution
  • Believing reverse alphabetical order applies
  • Thinking trigger renaming is unnecessary

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes