1 | #include "duckdb/parser/tableref/subqueryref.hpp" |
---|---|
2 | #include "duckdb/parser/transformer.hpp" |
3 | |
4 | using namespace duckdb; |
5 | using namespace std; |
6 | |
7 | unique_ptr<TableRef> Transformer::TransformRangeSubselect(PGRangeSubselect *root) { |
8 | Transformer subquery_transformer(this); |
9 | auto subquery = subquery_transformer.TransformSelectNode((PGSelectStmt *)root->subquery); |
10 | if (!subquery) { |
11 | return nullptr; |
12 | } |
13 | auto alias = TransformAlias(root->alias); |
14 | auto result = make_unique<SubqueryRef>(move(subquery), alias); |
15 | if (root->alias->colnames) { |
16 | for (auto node = root->alias->colnames->head; node != nullptr; node = node->next) { |
17 | result->column_name_alias.push_back(reinterpret_cast<PGValue *>(node->data.ptr_value)->val.str); |
18 | } |
19 | } |
20 | return move(result); |
21 | } |
22 |