1 | #include "duckdb/planner/binder.hpp" |
2 | #include "duckdb/parser/statement/show_statement.hpp" |
3 | #include "duckdb/planner/operator/logical_show.hpp" |
4 | |
5 | namespace duckdb { |
6 | |
7 | BoundStatement Binder::Bind(ShowStatement &stmt) { |
8 | BoundStatement result; |
9 | |
10 | if (stmt.info->is_summary) { |
11 | return BindSummarize(stmt); |
12 | } |
13 | auto plan = Bind(node&: *stmt.info->query); |
14 | stmt.info->types = plan.types; |
15 | stmt.info->aliases = plan.names; |
16 | |
17 | auto show = make_uniq<LogicalShow>(args: std::move(plan.plan)); |
18 | show->types_select = plan.types; |
19 | show->aliases = plan.names; |
20 | |
21 | result.plan = std::move(show); |
22 | |
23 | result.names = {"column_name" , "column_type" , "null" , "key" , "default" , "extra" }; |
24 | result.types = {LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR, |
25 | LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}; |
26 | properties.return_type = StatementReturnType::QUERY_RESULT; |
27 | return result; |
28 | } |
29 | |
30 | } // namespace duckdb |
31 | |