MXS-2337 Schemarouter responds correctly to SHOW TABLES

The router now handles the query similarly to a "SHOW TABLES FROM X"
with the current db assigned to X.
This commit is contained in:
Esa Korhonen 2019-02-22 14:01:20 +02:00
parent 6332f0876b
commit 4208dff2e6

View File

@ -1592,8 +1592,17 @@ bool SchemaRouterSession::send_tables(GWBUF* pPacket)
if (database.empty())
{
MXS_FREE(query);
return false;
// Was not a "show tables from x". If a current database is selected, use that as target.
if (!m_current_db.empty())
{
database = m_current_db;
}
else
{
// No current db, route the query to a server, likely getting "No database selected"
MXS_FREE(query);
return false;
}
}
ServerMap tablelist;