diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index 259fddc6713..296d9434f79 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -578,7 +578,7 @@ InterpreterSelectQuery::InterpreterSelectQuery( auto maybe_storage = DatabaseCatalog::instance().tryGetTable({table.table.database, table.table.table}, context); if (!maybe_storage) continue; - checkStorageSupportsTransactionsIfNeeded(storage, context, /* is_readonly_query */ true); + checkStorageSupportsTransactionsIfNeeded(maybe_storage, context, /* is_readonly_query */ true); } } diff --git a/tests/queries/0_stateless/03282_memory_transaction_crash.reference b/tests/queries/0_stateless/03282_memory_transaction_crash.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03282_memory_transaction_crash.sql b/tests/queries/0_stateless/03282_memory_transaction_crash.sql new file mode 100644 index 00000000000..996d6ff7d87 --- /dev/null +++ b/tests/queries/0_stateless/03282_memory_transaction_crash.sql @@ -0,0 +1,9 @@ +-- Tags: zookeeper +-- https://github.com/ClickHouse/ClickHouse/issues/72887 +DROP TABLE IF EXISTS t0; + +CREATE TABLE t0 (c0 Int) ENGINE = Memory(); +BEGIN TRANSACTION; +EXPLAIN SYNTAX SELECT 1 FROM (SELECT 1) tx JOIN t0 ON TRUE; -- { serverError NOT_IMPLEMENTED } +ROLLBACK; +DROP TABLE IF EXISTS t0;