Skip to content

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

Open
LucaCappelletti94 wants to merge 3 commits into
mainfrom
upstream/partition-of-untyped-columns
Open

LucaCappelletti94 wants to merge 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.62%. Comparing base (1e0bc45) to head (947917f).

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.61%   82.62%   +0.01%     
==========================================
  Files          42       42              
  Lines       35614    35633      +19     
  Branches    35614    35633      +19     
==========================================
+ Hits        29421    29442      +21     
  Misses       2659     2659              
+ Partials     3534     3532       -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 3 times, most recently from 141a4e6 to 1e4daab Compare October 30, 2026 17:33
@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/partition-of-untyped-columns branch from 1e4daab to 947917f Compare October 30, 2026 22:25
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