Bird
0
0

A BEFORE INSERT trigger on table customers is not firing as expected. You have multiple triggers on this event. What could cause this?

medium📝 Debug Q7 of 15
PostgreSQL - Triggers in PostgreSQL
A BEFORE INSERT trigger on table customers is not firing as expected. You have multiple triggers on this event. What could cause this?
ATriggers require explicit COMMIT to execute.
BAnother BEFORE INSERT trigger returns NULL, skipping subsequent triggers.
CTriggers must be named uniquely to fire.
DTriggers only fire AFTER the event, not BEFORE.
Step-by-Step Solution
Solution:
  1. Step 1: Understand trigger return behavior

    BEFORE triggers must return NEW row; returning NULL skips remaining triggers.
  2. Step 2: Identify cause of trigger skipping

    If an earlier trigger returns NULL, later triggers do not run.
  3. Final Answer:

    Another BEFORE INSERT trigger returns NULL, skipping subsequent triggers. -> Option B
  4. Quick Check:

    Returning NULL in BEFORE triggers skips others = Another BEFORE INSERT trigger returns NULL, skipping subsequent triggers. [OK]
Quick Trick: Returning NULL in BEFORE triggers stops later triggers [OK]
Common Mistakes:
  • Thinking triggers only fire AFTER events
  • Believing trigger names affect firing
  • Assuming COMMIT controls trigger execution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes