1#include "duckdb/main/relation/subquery_relation.hpp"
2#include "duckdb/main/client_context.hpp"
3#include "duckdb/parser/query_node.hpp"
4
5namespace duckdb {
6
7SubqueryRelation::SubqueryRelation(shared_ptr<Relation> child_p, string alias_p)
8 : Relation(child_p->context, RelationType::SUBQUERY_RELATION), child(std::move(child_p)),
9 alias(std::move(alias_p)) {
10 D_ASSERT(child.get() != this);
11 vector<ColumnDefinition> dummy_columns;
12 context.GetContext()->TryBindRelation(relation&: *this, result_columns&: dummy_columns);
13}
14
15unique_ptr<QueryNode> SubqueryRelation::GetQueryNode() {
16 return child->GetQueryNode();
17}
18
19string SubqueryRelation::GetAlias() {
20 return alias;
21}
22
23const vector<ColumnDefinition> &SubqueryRelation::Columns() {
24 return child->Columns();
25}
26
27string SubqueryRelation::ToString(idx_t depth) {
28 return child->ToString(depth);
29}
30
31} // namespace duckdb
32