slopgobblercobbler opened a new pull request, #2787:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2787
<!-- comma separated, or `none` -->
Dialects: generic, clickhouse
### Description
Fixes #2759.
When formatting `ShowStatementFilter::ILike(pattern)`, single quotes around
the pattern were omitted:
```rust
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`:
```rust
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`).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]