1#include "duckdb/planner/expression_binder/relation_binder.hpp"
2
3namespace duckdb {
4
5RelationBinder::RelationBinder(Binder &binder, ClientContext &context, string op)
6 : ExpressionBinder(binder, context), op(std::move(op)) {
7}
8
9BindResult RelationBinder::BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) {
10 auto &expr = *expr_ptr;
11 switch (expr.expression_class) {
12 case ExpressionClass::AGGREGATE:
13 return BindResult("aggregate functions are not allowed in " + op);
14 case ExpressionClass::DEFAULT:
15 return BindResult(op + " cannot contain DEFAULT clause");
16 case ExpressionClass::SUBQUERY:
17 return BindResult("subqueries are not allowed in " + op);
18 case ExpressionClass::WINDOW:
19 return BindResult("window functions are not allowed in " + op);
20 default:
21 return ExpressionBinder::BindExpression(expr_ptr, depth);
22 }
23}
24
25string RelationBinder::UnsupportedAggregateMessage() {
26 return "aggregate functions are not allowed in " + op;
27}
28
29} // namespace duckdb
30