Skip to content

PostgreSQL: Support DROP STATISTICS - #3081

Open
icefery wants to merge 1 commit into
apache:mainfrom
icefery:postgres/drop-statistics
Open

icefery wants to merge 1 commit into
apache:mainfrom
icefery:postgres/drop-statistics

Conversation

@icefery

@icefery icefery commented Dec 1, 2026

Copy link
Copy Markdown

Dialects: PostgreSQL, Generic

DROP STATISTICS IF EXISTS app.stats, public.other RESTRICT; fails because DROP does not recognize statistics objects. This adds ObjectType::Statistics to the existing DROP statement. It preserves the names and drop behavior without accepting TEMPORARY, PURGE, or ON.

PostgreSQL syntax

Seven focused tests passed with all features. Rustfmt and Clippy on the library and Common/PostgreSQL test targets passed. The round-trip fuzzer completed 256 runs seeded with both single- and multiple-object statements.

AI assistance was used for the implementation, tests, and draft.

@LucaCappelletti94 LucaCappelletti94 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.

Add the fuzz seed and fuzz differentially the syntax against pg_query using the harness.

@LucaCappelletti94 LucaCappelletti94 added api change waiting on contributor The review needs further refinements by its author labels Dec 1, 2026
@icefery
icefery marked this pull request as draft December 1, 2026 13:28
@icefery
icefery force-pushed the postgres/drop-statistics branch from 435c171 to ce90410 Compare December 1, 2026 14:11
- Reuse the DROP statement AST for extended statistics objects.
- Preserve qualified names and drop behavior without accepting unrelated modifiers.
@icefery
icefery force-pushed the postgres/drop-statistics branch from ce90410 to aa242f4 Compare December 1, 2026 14:25
@icefery

icefery commented Dec 1, 2026

Copy link
Copy Markdown
Author

@LucaCappelletti94

Hey there! Could you please take a moment to review it again sometime?

I plan to modify other PRs after this approach complies with the contribution guidelines;

I'm currently working on a formatting tool. Once the upstream supports it, I'll be able to directly use the existing libraries. Thank you very much!

@icefery
icefery marked this pull request as ready for review December 1, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change PostgreSQL waiting on contributor The review needs further refinements by its author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants