1#include "duckdb/parser/expression/collate_expression.hpp"
2#include "duckdb/planner/expression_binder.hpp"
3
4using namespace duckdb;
5using namespace std;
6
7BindResult ExpressionBinder::BindExpression(CollateExpression &expr, idx_t depth) {
8 // first try to bind the child of the cast expression
9 string error = Bind(&expr.child, depth);
10 if (!error.empty()) {
11 return BindResult(error);
12 }
13 auto &child = (BoundExpression &)*expr.child;
14 if (child.sql_type.id != SQLTypeId::VARCHAR) {
15 throw BinderException("collations are only supported for type varchar");
16 }
17 child.sql_type.collation = expr.collation;
18 return BindResult(move(child.expr), child.sql_type);
19}
20