Bird
0
0

In PostgreSQL, what effect does adding WITH CHECK OPTION to a view have on data modifications through that view?

easy📝 Conceptual Q1 of 15
PostgreSQL - Views and Materialized Views
In PostgreSQL, what effect does adding WITH CHECK OPTION to a view have on data modifications through that view?
AIt automatically updates the base table when the view is queried.
BIt prevents inserts or updates that would result in rows not satisfying the view's WHERE condition.
CIt allows the view to be indexed for faster queries.
DIt restricts the view to read-only access only.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of WITH CHECK OPTION

    This option enforces that any data modification through the view must satisfy the view's defining condition.
  2. Step 2: Analyze the impact on inserts and updates

    If an insert or update would cause a row to not meet the view's WHERE clause, it is rejected.
  3. Final Answer:

    It prevents inserts or updates that would result in rows not satisfying the view's WHERE condition. -> Option B
  4. Quick Check:

    Modifications must comply with view condition [OK]
Quick Trick: Modifications must satisfy view conditions to succeed [OK]
Common Mistakes:
  • Thinking WITH CHECK OPTION makes the view read-only
  • Assuming it automatically updates base tables on SELECT
  • Believing it enables indexing on views

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes