Skip to content

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

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
upstream/partition-of-untyped-columns
Oct 31, 2026
Merged

LucaCappelletti94 merged 3 commits 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
@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.72%. Comparing base (f373787) to head (748de2e).

Files with missing lines Patch % Lines
src/parser/mod.rs 96.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2766      +/-   ##
==========================================
+ Coverage   82.70%   82.72%   +0.01%     
==========================================
  Files          42       42              
  Lines       35770    35789      +19     
  Branches    35770    35789      +19     
==========================================
+ Hits        29584    29605      +21     
  Misses       2668     2668              
+ Partials     3518     3516       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/partition-of-untyped-columns branch 2 times, most recently from ee786a6 to 717d46f Compare October 30, 2026 07:47

@s5dsn-eqee s5dsn-eqee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/partition-of-untyped-columns branch 8 times, most recently from 512463b to 467f29b Compare October 31, 2026 10:46
@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/partition-of-untyped-columns branch from 467f29b to 748de2e Compare October 31, 2026 12:28
@LucaCappelletti94

Copy link
Copy Markdown
Contributor Author

Thanks @s5dsn-eqee for the review, I will merge this now.

cc @alamb

@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit db724c9 Oct 31, 2026
10 checks passed
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

3 participants