Bird
0
0

You created this trigger:

medium📝 Debug Q7 of 15
PostgreSQL - Triggers in PostgreSQL
You created this trigger:
CREATE TRIGGER trg_instead_of_update INSTEAD OF UPDATE ON v_emp FOR EACH ROW EXECUTE FUNCTION trg_v_emp_update();

But when updating the view, you get: ERROR: function trg_v_emp_update() does not exist
What is the likely cause?
AThe trigger function was not created or has a different name/signature.
BINSTEAD OF triggers cannot be created on views.
CThe trigger syntax is invalid; INSTEAD OF must come after ON clause.
DThe view v_emp does not support updates.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error says the function trg_v_emp_update() does not exist, meaning it was not created or named differently.
  2. Step 2: Check other options

    INSTEAD OF triggers are valid on views, syntax is correct, and view update support depends on triggers.
  3. Final Answer:

    The trigger function was not created or has a different name/signature. -> Option A
  4. Quick Check:

    Missing trigger function causes this error = The trigger function was not created or has a different name/signature. [OK]
Quick Trick: Ensure trigger function exists before creating trigger [OK]
Common Mistakes:
  • Assuming INSTEAD OF triggers are invalid on views
  • Misplacing INSTEAD OF keyword in syntax
  • Ignoring missing or misnamed trigger functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes