Bird
0
0

You wrote this code:

medium📝 Debug Q14 of 15
PostgreSQL - Table Partitioning
You wrote this code:
CREATE TABLE logs (id INT, region TEXT, day DATE) PARTITION BY RANGE (region) SUBPARTITION BY LIST (day);

What is the error in this statement?
ARANGE partitioning cannot be done on a TEXT column
BPartitioning by RANGE requires a numeric or date type, not TEXT
CSyntax error: SUBPARTITION BY must come before PARTITION BY
DSUBPARTITION BY LIST cannot be used with RANGE partitioning
Step-by-Step Solution
Solution:
  1. Step 1: Check partition column data type

    Partitioning by RANGE requires a column with an orderable type like numeric or date, not TEXT.
  2. Step 2: Identify the error cause

    Here, region is TEXT, so RANGE partitioning on it is invalid.
  3. Final Answer:

    Partitioning by RANGE requires a numeric or date type, not TEXT -> Option B
  4. Quick Check:

    RANGE needs numeric/date, not TEXT [OK]
Quick Trick: RANGE partition needs numeric or date column [OK]
Common Mistakes:
  • Thinking TEXT can be used for RANGE partitioning
  • Confusing order of PARTITION BY and SUBPARTITION BY
  • Assuming SUBPARTITION BY LIST is invalid with RANGE

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes