Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 5be1445

Browse files
schedutronapavlo
authored andcommitted
Fix segfaults when no table found
1 parent ab25cda commit 5be1445

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/optimizer/query_to_operator_transformer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "parser/statements.h"
2727

2828
#include "catalog/manager.h"
29+
#include "common/exception.h"
2930

3031
using std::vector;
3132
using std::shared_ptr;
@@ -231,6 +232,10 @@ void QueryToOperatorTransformer::Visit(parser::InsertStatement *op) {
231232
catalog::Catalog::GetInstance()
232233
->GetDatabaseObject(op->GetDatabaseName(), txn_)
233234
->GetTableObject(op->GetTableName());
235+
236+
if (target_table == nullptr)
237+
throw CatalogException("Table " + op->GetTableName() + " is not found");
238+
234239
if (op->type == InsertType::SELECT) {
235240
auto insert_expr = std::make_shared<OperatorExpression>(
236241
LogicalInsertSelect::make(target_table));

0 commit comments

Comments
 (0)