When moving Oracle partitions that omit a lower or upper bound, translate them to Postgres/YSQL using MINVALUE and MAXVALUE. Also remember that YSQL range bounds are inclusive at FROM and exclusive at TO.
Common conversions
● Open lower bound (Oracle) → MINVALUE (YSQL)
Oracle (conceptual):
-- FOR VALUES FROM () TO (TIMESTAMP '2025-09-01 00:00:00')
YugabyteDB (YSQL):
CREATE TABLE sc_brand_merch_before_2025_09
PARTITION OF sc_brand_merch
FOR VALUES FROM (MINVALUE) TO (TIMESTAMP '2025-09-01 00:00:00');
● Open upper bound (Oracle) → MAXVALUE (YSQL)
Oracle (conceptual):
-- FOR VALUES FROM (TIMESTAMP '2025-09-01 00:00:00') TO ()
YugabyteDB (YSQL):
CREATE TABLE sc_brand_merch_2025_09_and_after
PARTITION OF sc_brand_merch
FOR VALUES FROM (TIMESTAMP '2025-09-01 00:00:00') TO (MAXVALUE);
● Fully open range
Oracle (conceptual):
-- FOR VALUES FROM () TO ()
YugabyteDB (YSQL):
CREATE TABLE sc_brand_merch_all_time
PARTITION OF sc_brand_merch
FOR VALUES FROM (MINVALUE) TO (MAXVALUE);
● Catch-all with DEFAULT
If you’d rather not define MINVALUE/MAXVALUE, you can add a default partition to capture anything not matched by explicit ranges:
CREATE TABLE sc_brand_merch_default
PARTITION OF sc_brand_merch DEFAULT;
(Useful during cutovers; later replace with explicit ranges.)
Notes & gotchas
➤ Always quote date/time literals (use DATE 'YYYY-MM-DD' or TIMESTAMP 'YYYY-MM-DD HH:MI:SS').
➤ Range partitions in YSQL are [FROM inclusive, TO exclusive], matching Postgres semantics.
➤ MINVALUE/MAXVALUE are the standard way to express unbounded ends in Postgres/YSQL.