1#include "duckdb/parser/tableref/subqueryref.hpp"
2#include "duckdb/planner/binder.hpp"
3#include "duckdb/planner/tableref/bound_subqueryref.hpp"
4
5using namespace duckdb;
6using namespace std;
7
8unique_ptr<BoundTableRef> Binder::Bind(SubqueryRef &ref) {
9 auto binder = make_unique<Binder>(context, this);
10 auto subquery = binder->BindNode(*ref.subquery);
11 idx_t bind_index = subquery->GetRootIndex();
12 auto result = make_unique<BoundSubqueryRef>(move(binder), move(subquery));
13
14 bind_context.AddSubquery(bind_index, ref.alias, ref, *result->subquery);
15 MoveCorrelatedExpressions(*result->binder);
16 return move(result);
17}
18