1#include "duckdb/parser/statement/delete_statement.hpp"
2#include "duckdb/parser/transformer.hpp"
3
4using namespace duckdb;
5using namespace std;
6
7unique_ptr<DeleteStatement> Transformer::TransformDelete(PGNode *node) {
8 auto stmt = reinterpret_cast<PGDeleteStmt *>(node);
9 assert(stmt);
10 auto result = make_unique<DeleteStatement>();
11
12 result->condition = TransformExpression(stmt->whereClause);
13 result->table = TransformRangeVar(stmt->relation);
14 if (result->table->type != TableReferenceType::BASE_TABLE) {
15 throw Exception("Can only delete from base tables!");
16 }
17 return result;
18}
19