Skip to content

fix: type inference for sql rewrite#8052

Open
sunng87 wants to merge 1 commit intoGreptimeTeam:mainfrom
sunng87:fix/type-inferrence-for-rewrited-sql
Open

fix: type inference for sql rewrite#8052
sunng87 wants to merge 1 commit intoGreptimeTeam:mainfrom
sunng87:fix/type-inferrence-for-rewrited-sql

Conversation

@sunng87
Copy link
Copy Markdown
Member

@sunng87 sunng87 commented Apr 29, 2026

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

#8050

What's changed and what's your intention?

We have a sql rewrite rule that transform $1::int4 to arrow_cast($1, "Int32"). This patch fixes inference for these cases.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@sunng87 sunng87 requested review from a team, discord9, evenyag and waynexia as code owners April 29, 2026 09:18
@github-actions github-actions Bot added size/XS docs-not-required This change does not impact docs. labels Apr 29, 2026
@sunng87 sunng87 requested a review from killme2008 April 29, 2026 09:18
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the SQL planner to correctly infer parameter types from arrow_cast expressions, which are typically generated during explicit type casting (e.g., $1::INT64). Additionally, it improves the error message in the Postgres server to suggest explicit casting when a parameter type is unknown. I have no feedback to provide as no review comments were present.

@sunng87 sunng87 changed the title fix: type inference for rewrited sql fix: type inference for sql rewrite May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pg wire rejects standard numeric type OIDs (int4 / int8 / float8) at Parse with unknown_parameter_type

2 participants