Skip to content

PostgreSQL: Support PostgreSQL ANALYZE with optional table and column#2187

Merged
iffyio merged 3 commits intoapache:mainfrom
guan404ming:pg-analyze-columns
Feb 6, 2026
Merged

PostgreSQL: Support PostgreSQL ANALYZE with optional table and column#2187
iffyio merged 3 commits intoapache:mainfrom
guan404ming:pg-analyze-columns

Conversation

@guan404ming
Copy link
Member

Why

ANALYZE, ANALYZE t, and ANALYZE t (col1, col2) all failed because parse_analyze() unconditionally required a table name and didn't handle the PostgreSQL parenthesized column syntax.

How

Made table_name optional (Option) in the Analyze struct and added column list parsing after the table name. Updated Display and Spanned to match.

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
/// Supported syntax varies by dialect:
/// - Hive: `ANALYZE TABLE t [PARTITION (...)] COMPUTE STATISTICS [NOSCAN] [FOR COLUMNS [col1, ...]] [CACHE METADATA]`
/// - PostgreSQL: `ANALYZE [VERBOSE] [t [(col1, ...)]]`
/// - General: `ANALYZE [TABLE] t`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a link to the postgres docs describing the syntax? maybe this one https://www.postgresql.org/docs/current/sql-analyze.html

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice suggestion, just updated. Thanks!

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @guan404ming!

@iffyio iffyio added this pull request to the merge queue Feb 6, 2026
Merged via the queue into apache:main with commit 0924f3a Feb 6, 2026
10 checks passed
@guan404ming
Copy link
Member Author

Thanks!

@guan404ming guan404ming deleted the pg-analyze-columns branch February 7, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments