Skip to content

PostgreSQL: Parse a cast on a qualified wildcard - #2780

Open
LucaCappelletti94 wants to merge 5 commits into
mainfrom
upstream/qualified-wildcard-cast
Open

LucaCappelletti94 wants to merge 5 commits into
mainfrom
upstream/qualified-wildcard-cast

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SELECT t.*::t AS t FROM t fails under PostgreSqlDialect with Expected: end of statement, found: ::, and so do UPDATE t SET a = 1 RETURNING t.*::t and SELECT f(t.*::t) FROM t. PostgreSQL accepts all three, and pg_get_functiondef, pg_get_viewdef and pg_dump print a whole-row reference at the top of a target list in exactly this form, because the cast stops t.* from being expanded into its columns (ruleutils.c, get_variable).

Parser::parse_wildcard_expr returned the qualified wildcard as soon as it read t.*, before looking at what follows. When :: comes next it now parses the item as an expression, where t.* is already an operand under PostgreSQL (WHERE t.* IS NOT NULL parses today), so the item becomes a Cast of Expr::QualifiedWildcard. A plain t.* keeps its wildcard select item.

Very small change, very long explaination.

@LucaCappelletti94 LucaCappelletti94 added enhancement New feature or request PostgreSQL labels Oct 31, 2026
@codecov-commenter

codecov-commenter commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.11%. Comparing base (1071d75) to head (6ec6246).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2780      +/-   ##
==========================================
+ Coverage   83.09%   83.11%   +0.02%     
==========================================
  Files          42       42              
  Lines       36261    36262       +1     
  Branches    36261    36262       +1     
==========================================
+ Hits        30130    30139       +9     
+ Misses       2636     2631       -5     
+ Partials     3495     3492       -3     

☔ 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/qualified-wildcard-cast branch from a084522 to e198813 Compare November 2, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants