Bird
0
0

You have a jsonb column but your query using @> operator returns an error. What is the most likely cause?

medium📝 Debug Q6 of 15
PostgreSQL - JSON and JSONB
You have a jsonb column but your query using @> operator returns an error. What is the most likely cause?
AThe database version does not support JSON.
BThe query syntax is missing a semicolon.
CThe JSON data is invalid.
DThe column is actually <code>json</code>, not <code>jsonb</code>.
Step-by-Step Solution
Solution:
  1. Step 1: Check data type compatibility with @> operator

    The @> operator works only with jsonb type, not json.
  2. Step 2: Identify common causes of errors

    If the column is json, using @> causes an error. Syntax or invalid data usually cause different errors.
  3. Final Answer:

    The column is actually json, not jsonb. -> Option D
  4. Quick Check:

    @> operator requires jsonb column = A [OK]
Quick Trick: Verify column type before using jsonb operators [OK]
Common Mistakes:
  • Assuming syntax error causes @> failure
  • Ignoring data type mismatch
  • Blaming invalid JSON for operator errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes