383550 {
383551 auto &profiler = QueryProfiler::Get(context);
383552 auto parameter_count = statement.named_param_map.size();
383553
383554 BoundParameterMap bound_parameters(parameter_data);
383555
383556
383557 bool parameters_resolved = true;
383558 try {
383559 profiler.StartPhase(MetricType::PLANNER_BINDING);
383560 binder->SetParameters(bound_parameters);
383561 auto bound_statement = binder->Bind(statement);
383562 profiler.EndPhase();
383563
383564 RunPostBindExtensions(context, *binder, bound_statement);
383565
383566 this->names = bound_statement.names;
383567 this->types = bound_statement.types;
383568 this->plan = std::move(bound_statement.plan);
383569 } catch (const std::exception &ex) {
383570 ErrorData error(ex);
383571 this->plan = nullptr;
383572 if (error.Type() == ExceptionType::PARAMETER_NOT_RESOLVED) {
383573
383574 this->names = {"unknown"};
383575 this->types = {LogicalTypeId::UNKNOWN};
383576 parameters_resolved = false;
383577 } else if (error.Type() != ExceptionType::INVALID) {
383578
383579 for (auto &extension_op : OperatorExtension::Iterate(context)) {
383580 auto bound_statement =
383581 extension_op->Bind(context, *this->binder, extension_op->operator_info.get(), statement);
383582 if (bound_statement.plan != nullptr) {
383583 RunPostBindExtensions(context, *this->binder, bound_statement);
383584
383585 this->names = bound_statement.names;
383586 this->types = bound_statement.types;
383587 this->plan = std::move(bound_statement.plan);
383588 break;
383589 }
383590 }
383591 if (!this->plan) {
383592 throw;
383593 }
383594 } else {
383595 throw;
383596 }
383597 }
383598 if (this->plan) {
383599 auto max_tree_depth = Settings::Get<MaxExpressionDepthSetting>(context);
383600 CheckTreeDepth(*plan, max_tree_depth);
383601
383602 this->plan = FlattenDependentJoins::DecorrelateIndependent(*this->binder, std::move(this->plan));
383603 }
383604 this->properties = binder->GetStatementProperties();
383605 this->properties.parameter_count = parameter_count;
383606 properties.bound_all_parameters = !bound_parameters.rebind && parameters_resolved;
383607
383609
383610
383611 for (auto &kv : bound_parameters.GetParameters()) {
383612 auto &identifier = kv.first;
383613 auto ¶m = kv.second;
383614
383615 if (!param->return_type.IsValid()) {
383616 properties.bound_all_parameters = false;
383617 continue;
383618 }
383619 param->SetValue(Value(param->return_type));
383620 value_map[identifier] = param;
383621 }
383622}
static void VerifyPlan(ClientContext &context, unique_ptr< LogicalOperator > &op, optional_ptr< bound_parameter_map_t > map=nullptr)
Definition duckdb.cpp:383683