mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #50977 from valbok/empty-table-overrides
MaterializedMySQL: Keep parentheses for empty table overrides
This commit is contained in:
commit
b7fbc4dd8e
@ -36,8 +36,6 @@ void ASTTableOverride::formatImpl(const FormatSettings & settings_, FormatState
|
||||
settings.ostr << hl_keyword << "TABLE OVERRIDE " << hl_none;
|
||||
ASTIdentifier(table_name).formatImpl(settings, state, frame);
|
||||
}
|
||||
if (!columns && (!storage || storage->children.empty()))
|
||||
return;
|
||||
auto override_frame = frame;
|
||||
if (is_standalone)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ INSTANTIATE_TEST_SUITE_P(ParserCreateDatabaseQuery, ParserTest,
|
||||
},
|
||||
{
|
||||
"CREATE DATABASE db ENGINE=Foo TABLE OVERRIDE `tbl` (), TABLE OVERRIDE a (COLUMNS (_created DateTime MATERIALIZED now())), TABLE OVERRIDE b (PARTITION BY rand())",
|
||||
"CREATE DATABASE db\nENGINE = Foo\nTABLE OVERRIDE `tbl`,\nTABLE OVERRIDE `a`\n(\n COLUMNS\n (\n `_created` DateTime MATERIALIZED now()\n )\n),\nTABLE OVERRIDE `b`\n(\n PARTITION BY rand()\n)"
|
||||
"CREATE DATABASE db\nENGINE = Foo\nTABLE OVERRIDE `tbl`\n(\n\n),\nTABLE OVERRIDE `a`\n(\n COLUMNS\n (\n `_created` DateTime MATERIALIZED now()\n )\n),\nTABLE OVERRIDE `b`\n(\n PARTITION BY rand()\n)"
|
||||
},
|
||||
{
|
||||
"CREATE DATABASE db ENGINE=MaterializeMySQL('addr:port', 'db', 'user', 'pw') TABLE OVERRIDE tbl (COLUMNS (id UUID) PARTITION BY toYYYYMM(created))",
|
||||
|
@ -2042,6 +2042,18 @@ def table_overrides(clickhouse_node, mysql_node, service_name):
|
||||
f"{explain_with_table_func} {testcase[0]}"
|
||||
)
|
||||
|
||||
clickhouse_node.query("DROP DATABASE IF EXISTS table_overrides")
|
||||
# Check empty table overrides
|
||||
clickhouse_node.query(
|
||||
f"""
|
||||
CREATE DATABASE table_overrides ENGINE=MaterializeMySQL('{service_name}:3306', 'table_overrides', 'root', 'clickhouse')
|
||||
TABLE OVERRIDE t1 ()
|
||||
"""
|
||||
)
|
||||
check_query(clickhouse_node, "SELECT count() FROM table_overrides.t1", "1001\n")
|
||||
show_db = clickhouse_node.query("SHOW CREATE DATABASE table_overrides")
|
||||
assert "TABLE OVERRIDE `t1`\\n(\\n\\n)" in show_db, show_db
|
||||
|
||||
clickhouse_node.query("DROP DATABASE IF EXISTS table_overrides")
|
||||
mysql_node.query("DROP DATABASE IF EXISTS table_overrides")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user