Skip to content

PostgreSQL: Support ONLY and * table inheritance markers - #2770

Merged
LucaCappelletti94 merged 2 commits into
mainfrom
upstream/postgres-inheritance-markers
Oct 31, 2026
Merged

LucaCappelletti94 merged 2 commits into
mainfrom
upstream/postgres-inheritance-markers

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

SELECT * FROM ONLY t parsed as a table named ONLY aliased t. It displayed back unchanged, so round-trip tests could not see it, while the relation visitor reported ONLY instead of t. ONLY (t) became a call to a function ONLY, and ONLY t AS x, t* and app.t* AS x failed to parse. UPDATE and DELETE behaved the same. PostgreSQL 16 accepts all of them (https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM).

TableFactor::Table now carries an inheritance field, parsed when the new Dialect::supports_table_inheritance_markers holds, which PostgreSQL and Generic enable. It holds an enum since PostgreSQL accepts at most one of the two markers on a table, and Only records whether the name was parenthesized so that ONLY (t) displays as written. A table named only stays reachable as "only".

@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.64%. Comparing base (3a7f9ef) to head (df088c4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2770      +/-   ##
==========================================
+ Coverage   82.62%   82.64%   +0.01%     
==========================================
  Files          42       42              
  Lines       35636    35654      +18     
  Branches    35636    35654      +18     
==========================================
+ Hits        29445    29465      +20     
  Misses       2661     2661              
+ Partials     3530     3528       -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/postgres-inheritance-markers branch from a737aaf to 7dd413a Compare October 30, 2026 07:58

@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/postgres-inheritance-markers branch from 7dd413a to d10f855 Compare October 30, 2026 11:16
@LucaCappelletti94

Copy link
Copy Markdown
Contributor Author

Thanks @s5dsn-eqee for the review, I will be merging this one now.

cc @alamb

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/postgres-inheritance-markers branch 2 times, most recently from ecd6a86 to 50e9e91 Compare October 30, 2026 17:30
@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/postgres-inheritance-markers branch from 50e9e91 to f070ff4 Compare October 30, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants