| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/planner/operator/logical_update.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/planner/logical_operator.hpp" |
| 12 | |
| 13 | namespace duckdb { |
| 14 | class TableCatalogEntry; |
| 15 | |
| 16 | class LogicalUpdate : public LogicalOperator { |
| 17 | public: |
| 18 | static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_UPDATE; |
| 19 | |
| 20 | public: |
| 21 | explicit LogicalUpdate(TableCatalogEntry &table); |
| 22 | |
| 23 | //! The base table to update |
| 24 | TableCatalogEntry &table; |
| 25 | //! table catalog index |
| 26 | idx_t table_index; |
| 27 | //! if returning option is used, return the update chunk |
| 28 | bool return_chunk; |
| 29 | vector<PhysicalIndex> columns; |
| 30 | vector<unique_ptr<Expression>> bound_defaults; |
| 31 | bool update_is_del_and_insert; |
| 32 | |
| 33 | public: |
| 34 | void Serialize(FieldWriter &writer) const override; |
| 35 | static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader); |
| 36 | idx_t EstimateCardinality(ClientContext &context) override; |
| 37 | string GetName() const override; |
| 38 | |
| 39 | protected: |
| 40 | vector<ColumnBinding> GetColumnBindings() override; |
| 41 | void ResolveTypes() override; |
| 42 | }; |
| 43 | } // namespace duckdb |
| 44 |