Skip to content

Commit 3ef5fb5

Browse files
Backport #89914 to 25.10: Show datalake catalogs in SHOW DATABASES query
1 parent ad664bb commit 3ef5fb5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Interpreters/InterpreterShowTablesQuery.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ BlockIO InterpreterShowTablesQuery::execute()
232232
}
233233
auto rewritten_query = getRewrittenQuery();
234234
String database = getContext()->resolveDatabase(query.getFrom());
235-
if (DatabaseCatalog::instance().isDatalakeCatalog(database))
235+
if (query.databases || DatabaseCatalog::instance().isDatalakeCatalog(database))
236236
{
237237
auto context_copy = Context::createCopy(getContext());
238-
/// HACK To always show them in explicit "SHOW TABLES" queries
238+
/// HACK To always show them in explicit "SHOW TABLES" and "SHOW DATABASES" queries
239239
context_copy->setSetting("show_data_lake_catalogs_in_system_tables", true);
240240
return executeQuery(rewritten_query, context_copy, QueryFlags{ .internal = true }).second;
241241
}

tests/integration/test_database_glue/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ def test_system_tables(started_cluster):
617617
node.query(f"SELECT count() FROM {CATALOG_NAME}.`{namespace}.{table_name}`")
618618
)
619619

620+
assert CATALOG_NAME in node.query("SHOW DATABASES")
621+
assert table_name in node.query(f"SHOW TABLES FROM {CATALOG_NAME}")
620622
# system.tables
621623
assert int(node.query(f"SELECT count() FROM system.tables WHERE database = '{CATALOG_NAME}' and table ilike '%{root_namespace}%' SETTINGS show_data_lake_catalogs_in_system_tables = true").strip()) == 4
622624
assert int(node.query(f"SELECT count() FROM system.tables WHERE database = '{CATALOG_NAME}' and table ilike '%{root_namespace}%'").strip()) == 0

0 commit comments

Comments
 (0)