In some cases EXPLAIN VIRTUAL does not show all virtual schema pushdowns or throws error
Details
| Detail name | Value |
|---|---|
| Changelog number | 32368 |
| Type | Bug |
| Status | Resolved |
| Affected versions | Exasol 7.1.0, Exasol 8.0.0, Exasol 8.29.0, Exasol 2025.1.0, Exasol 2025.2.0, Exasol 2026.1.0 |
| Fix versions | Exasol 2025.1.17 |
| Resolution Date | 2026-11-12 |
Description
For some queries that use virtual schemas, the EXPLAIN VIRTUAL statement does not show all virtual schema pushdowns or incorrectly returns the error "Explain virtual not possible on queries without virtual tables". To be affected a query must fulfill all of the following conditions:
- Use
EXPLAIN VIRTUAL. - Use at least one virtual table.
- Contain
UNION ALL. - In addition, the bug also depends on how the query gets optimized by the database. Due to changes in the optimizer between Exasol versions, the affected queries differ by version.
Please notice that this is just a displaying issue in EXPLAIN VIRTUAL. The queries investigated by EXPLAIN VIRTUAL still work correctly on their own and all required virtual schema pushdowns still happen. The profiling also records the pushdowns completely, see workaround below.
Example
-- Setup:
CREATE SCHEMA test;
OPEN SCHEMA test;
--/
CREATE LUA ADAPTER SCRIPT test.vs_adapter AS
cjson = require "cjson"
function adapter_call(json_req)
req = cjson.decode(json_req)
req.capabilities = {''}
req.schemaMetadata = { tables = {
{ name = 'VT', columns = {{ name = 'D', dataType = { type = 'DECIMAL', precision = 1, scale = 0 }}}},
{ name = 'VU', columns = {{ name = 'E', dataType = { type = 'DECIMAL', precision = 1, scale = 0 }}}}
}}
req.sql = "SELECT 1"
return cjson.encode(req)
end
/
;
CREATE VIRTUAL SCHEMA vs USING test.vs_adapter;
OPEN SCHEMA test;
CREATE TABLE test.t AS SELECT 1 a;
CREATE VIEW test.v AS
SELECT 1 e
FROM (
SELECT 1 b, 1 c
UNION ALL
SELECT 1, 1 FROM test.t
) cte
JOIN vs.vt ON cte.b = CAST(vt.d AS DECIMAL(1,0))
GROUP BY b;
-- Bug:
-- Observed: Error "Explain virtual not possible on queries without virtual tables"
-- Expected: Result with two rows showing the two pushdown queries.
EXPLAIN VIRTUAL
SELECT cte.b
FROM (
SELECT 1 AS b FROM DUAL
UNION ALL
SELECT a AS b FROM test.t
) cte
WHERE cte.b IN (SELECT 1 FROM vs.vt);
-- Observed: Result with one row showing one pushdown query.
-- Expected: Result with three rows showing three pushdown queries.
EXPLAIN VIRTUAL
SELECT (SELECT e FROM vs.vu)
FROM (
SELECT 1 AS b FROM DUAL
UNION ALL
SELECT a AS b FROM test.t
) cte
WHERE cte.b IN (SELECT 1 FROM vs.vt);
-- Example for a query which is affected only since a particular version:
-- Before version 2025.1.0:
-- Observed/Expected: Result with one row showing the pushdown query.
-- Since version 2025.1.0:
-- Observed: Error "Explain virtual not possible on queries without virtual tables"
-- Expected: Result with two rows showing the two pushdown queries.
EXPLAIN VIRTUAL
SELECT cte.b
FROM (
SELECT 1 AS b FROM DUAL
UNION ALL
SELECT a AS b FROM test.t
) cte
WHERE cte.b = (SELECT d FROM vs.vt);
-- Example for a query which is affected only since a particular version:
-- Before version 2026.1.0:
-- Observed/Expected: Result with one row showing the pushdown query.
-- Since version 2026.1.0:
-- Observed: Error "Explain virtual not possible on queries without virtual tables"
-- Expected: Result with two rows showing the two pushdown queries.
EXPLAIN VIRTUAL
SELECT * FROM test.v;
Workaround
The profiling system tables contain all virtual schema pushdowns, even if EXPLAIN VIRTUAL returns a wrong result or fails.
ALTER SESSION SET PROFILE = 'ON';
-- Affected EXPLAIN VIRTUAL statement returns error:
EXPLAIN VIRTUAL
SELECT cte.b
FROM (
SELECT 1 AS b FROM DUAL
UNION ALL
SELECT a AS b FROM test.t
) cte
WHERE cte.b IN (SELECT 1 FROM vs.vt);
FLUSH STATISTICS;
COMMIT;
-- The profile contains one row per pushdown, the REMARKS column shows the pushdown query:
SELECT SESSION_ID, STMT_ID, COMMAND_NAME, PART_ID, REMARKS, SQL_TEXT
FROM EXA_STATISTICS.EXA_USER_PROFILE_LAST_DAY
WHERE SESSION_ID = CURRENT_SESSION AND PART_NAME = 'PUSHDOWN'
ORDER BY SESSION_ID, STMT_ID, PART_ID;
Fix
EXPLAIN VIRTUAL now returns all virtual schema pushdowns and no longer fails.