Bird
0
0

Which record variable would you use in a BEFORE INSERT trigger to access the row data being inserted?

easy📝 Conceptual Q2 of 15
PostgreSQL - Triggers in PostgreSQL
Which record variable would you use in a BEFORE INSERT trigger to access the row data being inserted?
ANEW
BOLD_ROW
COLD
DPRE_INSERT
Step-by-Step Solution
Solution:
  1. Step 1: Identify trigger type

    In BEFORE INSERT triggers, the row does not exist yet, so OLD is not available.
  2. Step 2: Use NEW record

    NEW holds the data that will be inserted, so it is the correct record to access.
  3. Final Answer:

    NEW -> Option A
  4. Quick Check:

    NEW = row data to be inserted [OK]
Quick Trick: Use NEW for data being inserted in BEFORE INSERT triggers [OK]
Common Mistakes:
  • Using OLD in INSERT triggers
  • Assuming OLD_ROW is valid
  • Using PRE_INSERT which does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes