Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9501,7 +9501,7 @@ impl fmt::Display for ShowStatementFilter {
use ShowStatementFilter::*;
match self {
Like(pattern) => write!(f, "LIKE '{}'", value::escape_single_quote_string(pattern)),
ILike(pattern) => write!(f, "ILIKE {}", value::escape_single_quote_string(pattern)),
ILike(pattern) => write!(f, "ILIKE '{}'", value::escape_single_quote_string(pattern)),
Where(expr) => write!(f, "WHERE {expr}"),
NoKeyword(pattern) => write!(f, "'{}'", value::escape_single_quote_string(pattern)),
}
Expand Down
6 changes: 6 additions & 0 deletions tests/sqlparser_clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2367,3 +2367,9 @@ fn parse_create_table_engine_name_quoting() {
clickhouse_and_generic().verified_stmt("CREATE TABLE t (a INT) ENGINE = ``");
clickhouse().verified_stmt("CREATE TABLE t (a INT) ENGINE = MergeTree");
}

#[test]
fn test_show_databases_tables_ilike() {
clickhouse().verified_stmt("SHOW DATABASES ILIKE '%DE%'");
clickhouse().verified_stmt("SHOW TABLES ILIKE '%abc%'");
}
5 changes: 5 additions & 0 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16547,8 +16547,13 @@ fn test_show_dbs_schemas_tables_views() {
// LIKE option (infix/suffix)
let stmts = vec![
"SHOW CATALOGS LIKE '%abc'",
"SHOW CATALOGS ILIKE '%abc'",
"SHOW DATABASES LIKE '%abc'",
"SHOW DATABASES ILIKE '%abc'",
"SHOW SCHEMAS LIKE '%abc'",
"SHOW SCHEMAS ILIKE '%abc'",
"SHOW DATABASES LIKE 'a''b'",
"SHOW DATABASES ILIKE 'a''b'",
];
for stmt in stmts {
all_dialects_where(|d| d.supports_show_like_before_in()).verified_stmt(stmt);
Expand Down
Loading