Skip to content

PostgreSQL: Parse untyped column entries in CREATE TABLE ... PARTITION OF - #2766

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/partition-of-untyped-columns
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/partition-of-untyped-columns

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

In CREATE TABLE ... PARTITION OF, a column entry is column_name [ WITH OPTIONS ] [ column_constraint ... ] and carries no data type (https://www.postgresql.org/docs/current/sql-createtable.html). The parser always read a type there, so (id NOT NULL) became a column of type NOT with a NULL option, and (id) or (id DEFAULT 0) failed to parse.

In the PARTITION OF form, column entries now parse with DataType::Unspecified, the shape SQLite's untyped columns already use. WITH OPTIONS is a noise word that PostgreSQL's own parse tree also discards, so it is accepted and dropped like [ COLUMN ] in ALTER TABLE. A data type in this position is now rejected, as PostgreSQL rejects it.

Thanks to @s5dsn-eqee for spotting this one.

Closes #2762.

@LucaCappelletti94 LucaCappelletti94 added PostgreSQL bug Something isn't working enhancement New feature or request labels Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL: Column entries in CREATE TABLE ... PARTITION OF are parsed as typed columns

1 participant