Skip to content

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

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/postgres-inheritance-markers
Open

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2770      +/-   ##
==========================================
+ Coverage   82.61%   82.62%   +0.01%     
==========================================
  Files          42       42              
  Lines       35614    35632      +18     
  Branches    35614    35632      +18     
==========================================
+ Hits        29421    29441      +20     
  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/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 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