Skip to content

Generic: Fix quotes when displaying SHOW ... ILIKE patterns - #2787

Closed
slopgobblercobbler wants to merge 1 commit into
apache:mainfrom
slopgobblercobbler:fix/show-statement-ilike-quoting
Closed

slopgobblercobbler wants to merge 1 commit into
apache:mainfrom
slopgobblercobbler:fix/show-statement-ilike-quoting

Conversation

@slopgobblercobbler

Copy link
Copy Markdown

Dialects: generic, clickhouse

Description

Fixes #2759.

When formatting ShowStatementFilter::ILike(pattern), single quotes around the pattern were omitted:

ILike(pattern) => write!(f, "ILIKE {}", value::escape_single_quote_string(pattern)),

Consequently, statements such as SHOW DATABASES ILIKE '%DE%' were displayed as SHOW DATABASES ILIKE %DE%, failing roundtrip parsing whenever the pattern contains characters like % that are not valid barewords.

This PR adds the missing single quotes around the escaped string pattern, matching ShowStatementFilter::Like:

ILike(pattern) => write!(f, "ILIKE '{}'", value::escape_single_quote_string(pattern)),

Tests

  • Added verified statement tests for SHOW DATABASES ILIKE '%DE%' and SHOW TABLES ILIKE '%abc%' in tests/sqlparser_clickhouse.rs.
  • Added test coverage for SHOW CATALOGS/DATABASES/SCHEMAS ILIKE and single-quote escaping ('a''b') in tests/sqlparser_common.rs.
  • Verified 100% test pass rate locally (cargo test --all-features).

In `ShowStatementFilter::ILike`, the format string omitted single quotes around
the escaped string pattern, causing statements like `SHOW DATABASES ILIKE '%DE%'`
to format as `SHOW DATABASES ILIKE %DE%`, failing to reparse when the pattern is
not an identifier.

Closes apache#2759.
@LucaCappelletti94 LucaCappelletti94 added the Prolific Author author has opened PRs in many repositories in the last month label Nov 1, 2026
@alamb

alamb commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for the contribution. The change may well be correct, but I am closing this PR under the DataFusion AI policy, which also applies to sqlparser-rs: https://datafusion.apache.org/contributor-guide/ai-policy.html#what-is-an-ai-dump-and-why-it-is-not-helpful

Maintainer review time is the scarcest resource in this project. This account has recently opened many AI-generated PRs across many repositories. That suggests the changes aren't coming from someone who uses sqlparser-rs, and that no human will be around to discuss review feedback and maintain the code. Reviewing PRs like this costs us more time than it saves.

If you do use sqlparser-rs and this fix matters to you, please pick the one change you care most about. Then open a focused PR with a short description in your own words, one you have reviewed and understand, and we'd be happy to help with review.

@alamb alamb closed this Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ClickHouse Prolific Author author has opened PRs in many repositories in the last month

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SHOW ... ILIKE '<pattern>' is displayed without quotes

3 participants