| 1 | #include "duckdb/parser/statement/select_statement.hpp" |
|---|---|
| 2 | #include "duckdb/parser/transformer.hpp" |
| 3 | #include "duckdb/common/string_util.hpp" |
| 4 | |
| 5 | namespace duckdb { |
| 6 | |
| 7 | unique_ptr<QueryNode> Transformer::TransformSelectNode(duckdb_libpgquery::PGSelectStmt &select) { |
| 8 | if (select.pivot) { |
| 9 | return TransformPivotStatement(select); |
| 10 | } else { |
| 11 | return TransformSelectInternal(select); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | unique_ptr<SelectStatement> Transformer::TransformSelect(duckdb_libpgquery::PGSelectStmt &select, bool is_select) { |
| 16 | auto result = make_uniq<SelectStatement>(); |
| 17 | |
| 18 | // Both Insert/Create Table As uses this. |
| 19 | if (is_select) { |
| 20 | if (select.intoClause) { |
| 21 | throw ParserException("SELECT INTO not supported!"); |
| 22 | } |
| 23 | if (select.lockingClause) { |
| 24 | throw ParserException("SELECT locking clause is not supported!"); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | result->node = TransformSelectNode(select); |
| 29 | return result; |
| 30 | } |
| 31 | |
| 32 | unique_ptr<SelectStatement> Transformer::TransformSelect(optional_ptr<duckdb_libpgquery::PGNode> node, bool is_select) { |
| 33 | return TransformSelect(select&: PGCast<duckdb_libpgquery::PGSelectStmt>(node&: *node), is_select); |
| 34 | } |
| 35 | |
| 36 | } // namespace duckdb |
| 37 |