Bird
0
0

You try to create a list partitioned table with this command:

medium📝 Debug Q6 of 15
PostgreSQL - Table Partitioning
You try to create a list partitioned table with this command:
CREATE TABLE items (id INT, category TEXT) PARTITION BY LIST category;

What is the error in this statement?
AThe table must have a primary key before partitioning.
BMissing parentheses around the partition column in PARTITION BY LIST.
CLIST partitioning does not support TEXT columns.
DPARTITION BY LIST must be written as PARTITION BY RANGE.
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for PARTITION BY LIST

    PostgreSQL requires parentheses around the column name in PARTITION BY LIST.
  2. Step 2: Identify error in statement

    The statement misses parentheses: should be PARTITION BY LIST (category).
  3. Final Answer:

    Missing parentheses around the partition column in PARTITION BY LIST. -> Option B
  4. Quick Check:

    PARTITION BY LIST syntax needs parentheses [OK]
Quick Trick: Always use parentheses around columns in PARTITION BY LIST [OK]
Common Mistakes:
  • Omitting parentheses in PARTITION BY LIST
  • Thinking primary key is mandatory for partitioning
  • Confusing LIST with RANGE partitioning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes