You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PostgreSQL declarative partitioning is not represented by CreateTable:
A multi-column parent PARTITION BY fails at the comma.
CREATE TABLE ... PARTITION OF fails at OF for RANGE, LIST, HASH, and DEFAULT bounds.
SQL examples
CREATETABLEpg_range_parent (
tenant_id int,
happened_at timestamptz
) PARTITION BY RANGE (tenant_id, happened_at);
CREATETABLEpg_range_p1 PARTITION OF pg_range_parent
FOR VALUESFROM (1, MINVALUE) TO (2, MAXVALUE);
CREATETABLEpg_list_parent (region text) PARTITION BY LIST (region);
CREATETABLEpg_list_eu_us PARTITION OF pg_list_parent
FOR VALUESIN ('eu', 'us');
CREATETABLEpg_list_default PARTITION OF pg_list_parent DEFAULT;
CREATETABLEpg_hash_parent (tenant_id int) PARTITION BY HASH (tenant_id);
CREATETABLEpg_hash_p0 PARTITION OF pg_hash_parent
FOR VALUES WITH (MODULUS 4, REMAINDER 0);
Actual behavior
Tested with JSqlParser 5.4-SNAPSHOT at 9a32ff568f580178d9a27b101596aa43eb45d0b7:
The multi-column parent throws ParseException at the comma in (tenant_id, happened_at).
Every PARTITION OF form throws ParseException at OF.
Expected behavior
These statements should parse as CreateTable, deparse without losing partition clauses, and expose structured fields for:
partition strategy and ordered partition keys;
the parent table of a partition;
RANGE FROM/TO, LIST IN, HASH MODULUS/REMAINDER, and DEFAULT bounds.
Software information and server validation
JSqlParser: 5.4-SNAPSHOT
Database: PostgreSQL 18.6 (postgres:18)
All seven statements above executed successfully with ON_ERROR_STOP=1. pg_inherits, pg_get_partkeydef, and pg_get_expr(relpartbound, ...) confirmed the resulting parent/child partition metadata.
OpenAI Codex was used to assemble the syntax matrix and run the parser/server comparison. The cases were checked against the PostgreSQL 18 documentation and an actual PostgreSQL 18.6 server.
Activity