Bird
0
0

A trigger function causes an infinite loop when updating a row. What is a likely cause?

medium📝 Debug Q7 of 15
PostgreSQL - Triggers in PostgreSQL
A trigger function causes an infinite loop when updating a row. What is a likely cause?
AThe trigger function is written in the wrong language
BThe trigger updates the same table without disabling itself
CThe table has no primary key
DThe trigger is set to run AFTER DELETE
Step-by-Step Solution
Solution:
  1. Step 1: Understand trigger recursion

    If a trigger updates the same table it listens to without precautions, it can cause itself to run repeatedly.
  2. Step 2: Evaluate options

    The trigger updates the same table without disabling itself describes this common cause. Other options do not explain infinite loops.
  3. Final Answer:

    The trigger updates the same table without disabling itself -> Option B
  4. Quick Check:

    Trigger recursion causes infinite loops [OK]
Quick Trick: Avoid triggers updating same table without control [OK]
Common Mistakes:
  • Ignoring trigger recursion risks
  • Blaming language choice for loops
  • Thinking missing primary key causes loops

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes