duckdb 0.7.2-dev3441.0 → 0.7.2-dev3546.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configure.py +2 -0
- package/package.json +2 -2
- package/src/duckdb/extension/json/json_functions/json_create.cpp +1 -1
- package/src/duckdb/extension/json/json_functions/read_json.cpp +1 -0
- package/src/duckdb/src/catalog/catalog_entry/macro_catalog_entry.cpp +42 -0
- package/src/duckdb/src/catalog/catalog_search_path.cpp +5 -0
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -0
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +4 -4
- package/src/duckdb/src/common/compressed_file_system.cpp +2 -2
- package/src/duckdb/src/common/constants.cpp +1 -0
- package/src/duckdb/src/common/file_system.cpp +2 -2
- package/src/duckdb/src/common/row_operations/row_gather.cpp +2 -2
- package/src/duckdb/src/common/serializer/binary_deserializer.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_file_writer.cpp +1 -1
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +4 -3
- package/src/duckdb/src/common/serializer.cpp +1 -1
- package/src/duckdb/src/common/sort/radix_sort.cpp +5 -5
- package/src/duckdb/src/common/string_util.cpp +2 -2
- package/src/duckdb/src/common/types/bit.cpp +2 -2
- package/src/duckdb/src/common/types/blob.cpp +2 -2
- package/src/duckdb/src/common/types/data_chunk.cpp +2 -2
- package/src/duckdb/src/common/types/date.cpp +1 -1
- package/src/duckdb/src/common/types/decimal.cpp +2 -2
- package/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +14 -2
- package/src/duckdb/src/common/types/selection_vector.cpp +1 -1
- package/src/duckdb/src/common/types/time.cpp +1 -1
- package/src/duckdb/src/common/types/vector.cpp +10 -10
- package/src/duckdb/src/common/types/vector_buffer.cpp +11 -3
- package/src/duckdb/src/common/types/vector_cache.cpp +5 -5
- package/src/duckdb/src/common/virtual_file_system.cpp +4 -0
- package/src/duckdb/src/common/windows_util.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/distributive/string_agg.cpp +6 -3
- package/src/duckdb/src/core_functions/scalar/list/list_aggregates.cpp +2 -5
- package/src/duckdb/src/core_functions/scalar/string/printf.cpp +1 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +1 -1
- package/src/duckdb/src/execution/join_hashtable.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/outer_join_marker.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +1 -1
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +2 -7
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +4 -41
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +158 -0
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +2 -2
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +2 -2
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +3 -4
- package/src/duckdb/src/execution/window_segment_tree.cpp +1 -1
- package/src/duckdb/src/function/macro_function.cpp +43 -0
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
- package/src/duckdb/src/function/scalar/strftime_format.cpp +2 -1
- package/src/duckdb/src/function/scalar/string/concat.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/like.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +5 -5
- package/src/duckdb/src/function/scalar_macro_function.cpp +10 -0
- package/src/duckdb/src/function/table/copy_csv.cpp +3 -7
- package/src/duckdb/src/function/table/read_csv.cpp +60 -35
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_macro_function.cpp +10 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +0 -6
- package/src/duckdb/src/include/duckdb/common/allocator.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/compressed_file_system.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/constants.hpp +2 -5
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/helper.hpp +22 -9
- package/src/duckdb/src/include/duckdb/common/memory_safety.hpp +15 -0
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_writer.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_serializer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/sort/duckdb_pdqsort.hpp +11 -6
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/selection_vector.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/validity_mask.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types/vector_buffer.hpp +16 -6
- package/src/duckdb/src/include/duckdb/common/unique_ptr.hpp +53 -22
- package/src/duckdb/src/include/duckdb/common/vector.hpp +5 -2
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/outer_join_marker.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +0 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/buffered_csv_reader.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +27 -127
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/parallel_csv_reader.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/perfect_aggregate_hashtable.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/window_segment_tree.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +7 -1
- package/src/duckdb/src/include/duckdb/function/scalar/strftime_format.hpp +3 -4
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +7 -2
- package/src/duckdb/src/include/duckdb/function/table/read_csv.hpp +2 -4
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +5 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/join_relation.hpp +3 -3
- package/src/duckdb/src/include/duckdb/parser/parsed_data/attach_info.hpp +4 -7
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_macro_info.hpp +8 -12
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_sequence_info.hpp +6 -20
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +6 -18
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +4 -8
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +4 -38
- package/src/duckdb/src/include/duckdb/parser/parsed_data/transaction_info.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/vacuum_info.hpp +10 -10
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +5 -0
- package/src/duckdb/src/include/duckdb/storage/arena_allocator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/buffer/buffer_handle.hpp +9 -2
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/append_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +2 -2
- package/src/duckdb/src/optimizer/join_order/join_relation_set.cpp +5 -5
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +14 -6
- package/src/duckdb/src/parser/parsed_data/attach_info.cpp +42 -0
- package/src/duckdb/src/parser/parsed_data/create_index_info.cpp +0 -7
- package/src/duckdb/src/parser/parsed_data/create_info.cpp +19 -8
- package/src/duckdb/src/parser/parsed_data/create_macro_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/create_sequence_info.cpp +56 -0
- package/src/duckdb/src/parser/parsed_data/create_type_info.cpp +47 -0
- package/src/duckdb/src/parser/parsed_data/detach_info.cpp +34 -0
- package/src/duckdb/src/parser/parsed_data/drop_info.cpp +46 -0
- package/src/duckdb/src/parser/parsed_data/transaction_info.cpp +24 -0
- package/src/duckdb/src/parser/parsed_data/vacuum_info.cpp +37 -0
- package/src/duckdb/src/parser/statement/insert_statement.cpp +4 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +10 -0
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +27 -9
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +1 -0
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +32 -7
- package/src/duckdb/src/planner/logical_operator.cpp +1 -2
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +16 -25
- package/src/duckdb/src/planner/operator/logical_insert.cpp +30 -0
- package/src/duckdb/src/planner/operator/logical_simple.cpp +33 -5
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +6 -16
- package/src/duckdb/src/planner/planner.cpp +4 -13
- package/src/duckdb/src/storage/arena_allocator.cpp +1 -1
- package/src/duckdb/src/storage/buffer/buffer_handle.cpp +2 -11
- package/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +12 -6
- package/src/duckdb/src/storage/compression/string_uncompressed.cpp +2 -2
- package/src/duckdb/src/storage/statistics/list_stats.cpp +1 -1
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +1 -1
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/row_group.cpp +2 -2
- package/src/duckdb/src/storage/table/update_segment.cpp +7 -6
- package/src/duckdb/third_party/fsst/libfsst.cpp +1 -2
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +9 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +13 -12
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +2 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +12537 -12415
- package/src/duckdb/ub_src_catalog_catalog_entry.cpp +1 -1
- package/src/duckdb/ub_src_execution_operator_persistent.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +16 -0
- package/src/statement.cpp +15 -13
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +0 -104
@@ -4,18 +4,13 @@
|
|
4
4
|
#include "duckdb/parser/parsed_data/create_schema_info.hpp"
|
5
5
|
#include "duckdb/parser/parsed_data/create_table_info.hpp"
|
6
6
|
#include "duckdb/parser/parsed_data/create_view_info.hpp"
|
7
|
+
#include "duckdb/parser/parsed_data/create_sequence_info.hpp"
|
7
8
|
#include "duckdb/parser/parsed_data/create_database_info.hpp"
|
9
|
+
#include "duckdb/parser/parsed_data/create_type_info.hpp"
|
8
10
|
#include "duckdb/parser/parsed_data/alter_info.hpp"
|
11
|
+
#include "duckdb/parser/parsed_data/create_macro_info.hpp"
|
9
12
|
|
10
13
|
namespace duckdb {
|
11
|
-
void CreateInfo::DeserializeBase(Deserializer &deserializer) {
|
12
|
-
this->catalog = deserializer.Read<string>();
|
13
|
-
this->schema = deserializer.Read<string>();
|
14
|
-
this->on_conflict = deserializer.Read<OnCreateConflict>();
|
15
|
-
this->temporary = deserializer.Read<bool>();
|
16
|
-
this->internal = deserializer.Read<bool>();
|
17
|
-
this->sql = deserializer.Read<string>();
|
18
|
-
}
|
19
14
|
|
20
15
|
void CreateInfo::Serialize(Serializer &serializer) const {
|
21
16
|
serializer.Write(type);
|
@@ -28,6 +23,15 @@ void CreateInfo::Serialize(Serializer &serializer) const {
|
|
28
23
|
SerializeInternal(serializer);
|
29
24
|
}
|
30
25
|
|
26
|
+
void CreateInfo::DeserializeBase(Deserializer &deserializer) {
|
27
|
+
this->catalog = deserializer.Read<string>();
|
28
|
+
this->schema = deserializer.Read<string>();
|
29
|
+
this->on_conflict = deserializer.Read<OnCreateConflict>();
|
30
|
+
this->temporary = deserializer.Read<bool>();
|
31
|
+
this->internal = deserializer.Read<bool>();
|
32
|
+
this->sql = deserializer.Read<string>();
|
33
|
+
}
|
34
|
+
|
31
35
|
unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &deserializer) {
|
32
36
|
auto type = deserializer.Read<CatalogType>();
|
33
37
|
switch (type) {
|
@@ -41,6 +45,13 @@ unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &deserializer) {
|
|
41
45
|
return CreateViewInfo::Deserialize(deserializer);
|
42
46
|
case CatalogType::DATABASE_ENTRY:
|
43
47
|
return CreateDatabaseInfo::Deserialize(deserializer);
|
48
|
+
case CatalogType::TYPE_ENTRY:
|
49
|
+
return CreateTypeInfo::Deserialize(deserializer);
|
50
|
+
case CatalogType::MACRO_ENTRY:
|
51
|
+
case CatalogType::TABLE_MACRO_ENTRY:
|
52
|
+
return CreateMacroInfo::Deserialize(deserializer);
|
53
|
+
case CatalogType::SEQUENCE_ENTRY:
|
54
|
+
return CreateSequenceInfo::Deserialize(deserializer);
|
44
55
|
default:
|
45
56
|
throw NotImplementedException("Cannot deserialize '%s'", CatalogTypeToString(type));
|
46
57
|
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/create_macro_info.hpp"
|
2
|
+
#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
|
3
|
+
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
4
|
+
#include "duckdb/catalog/catalog.hpp"
|
5
|
+
|
6
|
+
namespace duckdb {
|
7
|
+
|
8
|
+
CreateMacroInfo::CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
|
9
|
+
}
|
10
|
+
|
11
|
+
CreateMacroInfo::CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
|
12
|
+
}
|
13
|
+
|
14
|
+
unique_ptr<CreateInfo> CreateMacroInfo::Copy() const {
|
15
|
+
auto result = make_uniq<CreateMacroInfo>();
|
16
|
+
result->function = function->Copy();
|
17
|
+
result->name = name;
|
18
|
+
CopyProperties(*result);
|
19
|
+
return std::move(result);
|
20
|
+
}
|
21
|
+
|
22
|
+
void CreateMacroInfo::SerializeInternal(Serializer &serializer) const {
|
23
|
+
FieldWriter writer(serializer);
|
24
|
+
writer.WriteString(name);
|
25
|
+
writer.WriteSerializable(*function);
|
26
|
+
writer.Finalize();
|
27
|
+
}
|
28
|
+
|
29
|
+
unique_ptr<CreateMacroInfo> CreateMacroInfo::Deserialize(Deserializer &deserializer) {
|
30
|
+
auto result = make_uniq<CreateMacroInfo>();
|
31
|
+
result->DeserializeBase(deserializer);
|
32
|
+
|
33
|
+
FieldReader reader(deserializer);
|
34
|
+
result->name = reader.ReadRequired<string>();
|
35
|
+
result->function = reader.ReadRequiredSerializable<MacroFunction>();
|
36
|
+
reader.Finalize();
|
37
|
+
|
38
|
+
if (result->function->type == MacroType::TABLE_MACRO) {
|
39
|
+
result->type = CatalogType::TABLE_MACRO_ENTRY;
|
40
|
+
} else {
|
41
|
+
result->type = CatalogType::MACRO_ENTRY;
|
42
|
+
}
|
43
|
+
return result;
|
44
|
+
}
|
45
|
+
|
46
|
+
} // namespace duckdb
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/create_sequence_info.hpp"
|
2
|
+
#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
|
3
|
+
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
4
|
+
#include "duckdb/catalog/catalog.hpp"
|
5
|
+
|
6
|
+
namespace duckdb {
|
7
|
+
|
8
|
+
CreateSequenceInfo::CreateSequenceInfo()
|
9
|
+
: CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1),
|
10
|
+
min_value(1), max_value(NumericLimits<int64_t>::Maximum()), start_value(1), cycle(false) {
|
11
|
+
}
|
12
|
+
|
13
|
+
unique_ptr<CreateInfo> CreateSequenceInfo::Copy() const {
|
14
|
+
auto result = make_uniq<CreateSequenceInfo>();
|
15
|
+
CopyProperties(*result);
|
16
|
+
result->name = name;
|
17
|
+
result->schema = schema;
|
18
|
+
result->usage_count = usage_count;
|
19
|
+
result->increment = increment;
|
20
|
+
result->min_value = min_value;
|
21
|
+
result->max_value = max_value;
|
22
|
+
result->start_value = start_value;
|
23
|
+
result->cycle = cycle;
|
24
|
+
return std::move(result);
|
25
|
+
}
|
26
|
+
|
27
|
+
void CreateSequenceInfo::SerializeInternal(Serializer &serializer) const {
|
28
|
+
FieldWriter writer(serializer);
|
29
|
+
writer.WriteString(name);
|
30
|
+
writer.WriteField(usage_count);
|
31
|
+
writer.WriteField(increment);
|
32
|
+
writer.WriteField(min_value);
|
33
|
+
writer.WriteField(max_value);
|
34
|
+
writer.WriteField(start_value);
|
35
|
+
writer.WriteField(cycle);
|
36
|
+
writer.Finalize();
|
37
|
+
}
|
38
|
+
|
39
|
+
unique_ptr<CreateSequenceInfo> CreateSequenceInfo::Deserialize(Deserializer &deserializer) {
|
40
|
+
auto result = make_uniq<CreateSequenceInfo>();
|
41
|
+
result->DeserializeBase(deserializer);
|
42
|
+
|
43
|
+
FieldReader reader(deserializer);
|
44
|
+
result->name = reader.ReadRequired<string>();
|
45
|
+
result->usage_count = reader.ReadRequired<uint64_t>();
|
46
|
+
result->increment = reader.ReadRequired<int64_t>();
|
47
|
+
result->min_value = reader.ReadRequired<int64_t>();
|
48
|
+
result->max_value = reader.ReadRequired<int64_t>();
|
49
|
+
result->start_value = reader.ReadRequired<int64_t>();
|
50
|
+
result->cycle = reader.ReadRequired<bool>();
|
51
|
+
reader.Finalize();
|
52
|
+
|
53
|
+
return result;
|
54
|
+
}
|
55
|
+
|
56
|
+
} // namespace duckdb
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/create_type_info.hpp"
|
2
|
+
#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp"
|
3
|
+
#include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
|
4
|
+
#include "duckdb/catalog/catalog.hpp"
|
5
|
+
|
6
|
+
namespace duckdb {
|
7
|
+
|
8
|
+
CreateTypeInfo::CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
9
|
+
}
|
10
|
+
CreateTypeInfo::CreateTypeInfo(string name_p, LogicalType type_p)
|
11
|
+
: CreateInfo(CatalogType::TYPE_ENTRY), name(std::move(name_p)), type(std::move(type_p)) {
|
12
|
+
}
|
13
|
+
|
14
|
+
unique_ptr<CreateInfo> CreateTypeInfo::Copy() const {
|
15
|
+
auto result = make_uniq<CreateTypeInfo>();
|
16
|
+
CopyProperties(*result);
|
17
|
+
result->name = name;
|
18
|
+
result->type = type;
|
19
|
+
if (query) {
|
20
|
+
result->query = query->Copy();
|
21
|
+
}
|
22
|
+
return std::move(result);
|
23
|
+
}
|
24
|
+
|
25
|
+
void CreateTypeInfo::SerializeInternal(Serializer &serializer) const {
|
26
|
+
FieldWriter writer(serializer);
|
27
|
+
writer.WriteString(name);
|
28
|
+
writer.WriteSerializable(type);
|
29
|
+
if (query) {
|
30
|
+
throw InternalException("Cannot serialize CreateTypeInfo with query");
|
31
|
+
}
|
32
|
+
writer.Finalize();
|
33
|
+
}
|
34
|
+
|
35
|
+
unique_ptr<CreateTypeInfo> CreateTypeInfo::Deserialize(Deserializer &deserializer) {
|
36
|
+
auto result = make_uniq<CreateTypeInfo>();
|
37
|
+
result->DeserializeBase(deserializer);
|
38
|
+
|
39
|
+
FieldReader reader(deserializer);
|
40
|
+
result->name = reader.ReadRequired<string>();
|
41
|
+
result->type = reader.ReadRequiredSerializable<LogicalType, LogicalType>();
|
42
|
+
reader.Finalize();
|
43
|
+
|
44
|
+
return result;
|
45
|
+
}
|
46
|
+
|
47
|
+
} // namespace duckdb
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/detach_info.hpp"
|
2
|
+
#include "duckdb/common/field_writer.hpp"
|
3
|
+
|
4
|
+
namespace duckdb {
|
5
|
+
|
6
|
+
DetachInfo::DetachInfo() {
|
7
|
+
}
|
8
|
+
|
9
|
+
unique_ptr<DetachInfo> DetachInfo::Copy() const {
|
10
|
+
auto result = make_uniq<DetachInfo>();
|
11
|
+
result->name = name;
|
12
|
+
result->if_not_found = if_not_found;
|
13
|
+
return result;
|
14
|
+
}
|
15
|
+
|
16
|
+
void DetachInfo::Serialize(Serializer &serializer) const {
|
17
|
+
FieldWriter writer(serializer);
|
18
|
+
writer.WriteString(name);
|
19
|
+
writer.WriteField(if_not_found);
|
20
|
+
writer.Finalize();
|
21
|
+
}
|
22
|
+
|
23
|
+
unique_ptr<ParseInfo> DetachInfo::Deserialize(Deserializer &deserializer) {
|
24
|
+
auto result = make_uniq<DetachInfo>();
|
25
|
+
|
26
|
+
FieldReader reader(deserializer);
|
27
|
+
result->name = reader.ReadRequired<string>();
|
28
|
+
result->if_not_found = reader.ReadRequired<OnEntryNotFound>();
|
29
|
+
reader.Finalize();
|
30
|
+
|
31
|
+
return std::move(result);
|
32
|
+
}
|
33
|
+
|
34
|
+
} // namespace duckdb
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/drop_info.hpp"
|
2
|
+
|
3
|
+
namespace duckdb {
|
4
|
+
|
5
|
+
DropInfo::DropInfo() : catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
|
6
|
+
}
|
7
|
+
|
8
|
+
unique_ptr<DropInfo> DropInfo::Copy() const {
|
9
|
+
auto result = make_uniq<DropInfo>();
|
10
|
+
result->type = type;
|
11
|
+
result->catalog = catalog;
|
12
|
+
result->schema = schema;
|
13
|
+
result->name = name;
|
14
|
+
result->if_not_found = if_not_found;
|
15
|
+
result->cascade = cascade;
|
16
|
+
result->allow_drop_internal = allow_drop_internal;
|
17
|
+
return result;
|
18
|
+
}
|
19
|
+
|
20
|
+
void DropInfo::Serialize(Serializer &serializer) const {
|
21
|
+
FieldWriter writer(serializer);
|
22
|
+
writer.WriteField<CatalogType>(type);
|
23
|
+
writer.WriteString(catalog);
|
24
|
+
writer.WriteString(schema);
|
25
|
+
writer.WriteString(name);
|
26
|
+
writer.WriteField(if_not_found);
|
27
|
+
writer.WriteField(cascade);
|
28
|
+
writer.WriteField(allow_drop_internal);
|
29
|
+
writer.Finalize();
|
30
|
+
}
|
31
|
+
|
32
|
+
unique_ptr<ParseInfo> DropInfo::Deserialize(Deserializer &deserializer) {
|
33
|
+
FieldReader reader(deserializer);
|
34
|
+
auto drop_info = make_uniq<DropInfo>();
|
35
|
+
drop_info->type = reader.ReadRequired<CatalogType>();
|
36
|
+
drop_info->catalog = reader.ReadRequired<string>();
|
37
|
+
drop_info->schema = reader.ReadRequired<string>();
|
38
|
+
drop_info->name = reader.ReadRequired<string>();
|
39
|
+
drop_info->if_not_found = reader.ReadRequired<OnEntryNotFound>();
|
40
|
+
drop_info->cascade = reader.ReadRequired<bool>();
|
41
|
+
drop_info->allow_drop_internal = reader.ReadRequired<bool>();
|
42
|
+
reader.Finalize();
|
43
|
+
return std::move(drop_info);
|
44
|
+
}
|
45
|
+
|
46
|
+
} // namespace duckdb
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/transaction_info.hpp"
|
2
|
+
#include "duckdb/common/field_writer.hpp"
|
3
|
+
|
4
|
+
namespace duckdb {
|
5
|
+
|
6
|
+
TransactionInfo::TransactionInfo(TransactionType type) : type(type) {
|
7
|
+
}
|
8
|
+
|
9
|
+
void TransactionInfo::Serialize(Serializer &serializer) const {
|
10
|
+
FieldWriter writer(serializer);
|
11
|
+
writer.WriteField(type);
|
12
|
+
writer.Finalize();
|
13
|
+
}
|
14
|
+
|
15
|
+
unique_ptr<ParseInfo> TransactionInfo::Deserialize(Deserializer &deserializer) {
|
16
|
+
FieldReader reader(deserializer);
|
17
|
+
auto transaction_type = reader.ReadRequired<TransactionType>();
|
18
|
+
reader.Finalize();
|
19
|
+
|
20
|
+
auto transaction_info = make_uniq<TransactionInfo>(transaction_type);
|
21
|
+
return std::move(transaction_info);
|
22
|
+
}
|
23
|
+
|
24
|
+
} // namespace duckdb
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/vacuum_info.hpp"
|
2
|
+
#include "duckdb/common/field_writer.hpp"
|
3
|
+
|
4
|
+
namespace duckdb {
|
5
|
+
|
6
|
+
VacuumInfo::VacuumInfo(VacuumOptions options) : options(options), has_table(false) {
|
7
|
+
}
|
8
|
+
|
9
|
+
unique_ptr<VacuumInfo> VacuumInfo::Copy() {
|
10
|
+
auto result = make_uniq<VacuumInfo>(options);
|
11
|
+
result->has_table = has_table;
|
12
|
+
if (has_table) {
|
13
|
+
result->ref = ref->Copy();
|
14
|
+
}
|
15
|
+
return result;
|
16
|
+
}
|
17
|
+
|
18
|
+
void VacuumInfo::Serialize(Serializer &serializer) const {
|
19
|
+
FieldWriter writer(serializer);
|
20
|
+
writer.WriteField(options.analyze);
|
21
|
+
writer.WriteField(options.vacuum);
|
22
|
+
writer.Finalize();
|
23
|
+
}
|
24
|
+
|
25
|
+
unique_ptr<ParseInfo> VacuumInfo::Deserialize(Deserializer &deserializer) {
|
26
|
+
|
27
|
+
VacuumOptions options;
|
28
|
+
FieldReader reader(deserializer);
|
29
|
+
options.analyze = reader.ReadRequired<bool>();
|
30
|
+
options.vacuum = reader.ReadRequired<bool>();
|
31
|
+
reader.Finalize();
|
32
|
+
|
33
|
+
auto vacuum_info = make_uniq<VacuumInfo>(options);
|
34
|
+
return std::move(vacuum_info);
|
35
|
+
}
|
36
|
+
|
37
|
+
} // namespace duckdb
|
@@ -30,7 +30,7 @@ InsertStatement::InsertStatement(const InsertStatement &other)
|
|
30
30
|
: SQLStatement(other), select_statement(unique_ptr_cast<SQLStatement, SelectStatement>(
|
31
31
|
other.select_statement ? other.select_statement->Copy() : nullptr)),
|
32
32
|
columns(other.columns), table(other.table), schema(other.schema), catalog(other.catalog),
|
33
|
-
default_values(other.default_values) {
|
33
|
+
default_values(other.default_values), column_order(other.column_order) {
|
34
34
|
cte_map = other.cte_map.Copy();
|
35
35
|
for (auto &expr : other.returning_list) {
|
36
36
|
returning_list.emplace_back(expr->Copy());
|
@@ -81,6 +81,9 @@ string InsertStatement::ToString() const {
|
|
81
81
|
if (table_ref && !table_ref->alias.empty()) {
|
82
82
|
result += StringUtil::Format(" AS %s", KeywordHelper::WriteOptionallyQuoted(table_ref->alias));
|
83
83
|
}
|
84
|
+
if (column_order == InsertColumnOrder::INSERT_BY_NAME) {
|
85
|
+
result += " BY NAME";
|
86
|
+
}
|
84
87
|
if (!columns.empty()) {
|
85
88
|
result += " (";
|
86
89
|
for (idx_t i = 0; i < columns.size(); i++) {
|
@@ -67,6 +67,16 @@ unique_ptr<InsertStatement> Transformer::TransformInsert(duckdb_libpgquery::PGNo
|
|
67
67
|
result->on_conflict_info = DummyOnConflictClause(stmt->onConflictAlias, result->schema);
|
68
68
|
result->table_ref = TransformRangeVar(stmt->relation);
|
69
69
|
}
|
70
|
+
switch (stmt->insert_column_order) {
|
71
|
+
case duckdb_libpgquery::PG_INSERT_BY_POSITION:
|
72
|
+
result->column_order = InsertColumnOrder::INSERT_BY_POSITION;
|
73
|
+
break;
|
74
|
+
case duckdb_libpgquery::PG_INSERT_BY_NAME:
|
75
|
+
result->column_order = InsertColumnOrder::INSERT_BY_NAME;
|
76
|
+
break;
|
77
|
+
default:
|
78
|
+
throw InternalException("Unrecognized insert column order in TransformInsert");
|
79
|
+
}
|
70
80
|
result->catalog = qname.catalog;
|
71
81
|
return result;
|
72
82
|
}
|
@@ -8,6 +8,15 @@
|
|
8
8
|
|
9
9
|
namespace duckdb {
|
10
10
|
|
11
|
+
string GetColumnsStringValue(ParsedExpression &expr) {
|
12
|
+
if (expr.type == ExpressionType::COLUMN_REF) {
|
13
|
+
auto &colref = expr.Cast<ColumnRefExpression>();
|
14
|
+
return colref.GetColumnName();
|
15
|
+
} else {
|
16
|
+
return expr.ToString();
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
11
20
|
bool Binder::FindStarExpression(unique_ptr<ParsedExpression> &expr, StarExpression **star, bool is_root,
|
12
21
|
bool in_columns) {
|
13
22
|
bool has_star = false;
|
@@ -33,7 +42,7 @@ bool Binder::FindStarExpression(unique_ptr<ParsedExpression> &expr, StarExpressi
|
|
33
42
|
vector<Value> values;
|
34
43
|
values.reserve(star_list.size());
|
35
44
|
for (auto &expr : star_list) {
|
36
|
-
values.emplace_back(expr
|
45
|
+
values.emplace_back(GetColumnsStringValue(*expr));
|
37
46
|
}
|
38
47
|
D_ASSERT(!values.empty());
|
39
48
|
|
@@ -139,17 +148,26 @@ void Binder::ExpandStarExpression(unique_ptr<ParsedExpression> expr,
|
|
139
148
|
}
|
140
149
|
auto &children = ListValue::GetChildren(val);
|
141
150
|
vector<unique_ptr<ParsedExpression>> new_list;
|
151
|
+
// scan the list for all selected columns and construct a lookup table
|
152
|
+
case_insensitive_map_t<bool> selected_set;
|
142
153
|
for (auto &child : children) {
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
154
|
+
selected_set.insert(make_pair(StringValue::Get(child), false));
|
155
|
+
}
|
156
|
+
// now check the list of all possible expressions and select which ones make it in
|
157
|
+
for (auto &expr : star_list) {
|
158
|
+
auto str = GetColumnsStringValue(*expr);
|
159
|
+
auto entry = selected_set.find(str);
|
160
|
+
if (entry != selected_set.end()) {
|
161
|
+
new_list.push_back(std::move(expr));
|
162
|
+
entry->second = true;
|
147
163
|
}
|
148
|
-
|
149
|
-
|
164
|
+
}
|
165
|
+
// check if all expressions found a match
|
166
|
+
for (auto &entry : selected_set) {
|
167
|
+
if (!entry.second) {
|
168
|
+
throw BinderException("Column \"%s\" was selected but was not found in the FROM clause",
|
169
|
+
entry.first);
|
150
170
|
}
|
151
|
-
names.push_back(qname.name);
|
152
|
-
new_list.push_back(make_uniq<ColumnRefExpression>(std::move(names)));
|
153
171
|
}
|
154
172
|
star_list = std::move(new_list);
|
155
173
|
} else {
|
@@ -455,7 +455,7 @@ static bool AnyConstraintReferencesGeneratedColumn(CreateTableInfo &table_info)
|
|
455
455
|
unique_ptr<LogicalOperator> DuckCatalog::BindCreateIndex(Binder &binder, CreateStatement &stmt,
|
456
456
|
TableCatalogEntry &table, unique_ptr<LogicalOperator> plan) {
|
457
457
|
D_ASSERT(plan->type == LogicalOperatorType::LOGICAL_GET);
|
458
|
-
auto &base =
|
458
|
+
auto &base = stmt.info->Cast<CreateIndexInfo>();
|
459
459
|
|
460
460
|
auto &get = plan->Cast<LogicalGet>();
|
461
461
|
// bind the index expressions
|
@@ -614,6 +614,7 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
614
614
|
// CREATE TYPE mood AS ENUM (SELECT 'happy')
|
615
615
|
auto query_obj = Bind(*create_type_info.query);
|
616
616
|
auto query = std::move(query_obj.plan);
|
617
|
+
create_type_info.query.reset();
|
617
618
|
|
618
619
|
auto &sql_types = query_obj.types;
|
619
620
|
if (sql_types.size() != 1) {
|
@@ -256,6 +256,7 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
|
|
256
256
|
if (base.query) {
|
257
257
|
// construct the result object
|
258
258
|
auto query_obj = Bind(*base.query);
|
259
|
+
base.query.reset();
|
259
260
|
result->query = std::move(query_obj.plan);
|
260
261
|
|
261
262
|
// construct the set of columns based on the names and types of the query
|
@@ -406,6 +406,26 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
|
|
406
406
|
// Add CTEs as bindable
|
407
407
|
AddCTEMap(stmt.cte_map);
|
408
408
|
|
409
|
+
auto values_list = stmt.GetValuesList();
|
410
|
+
|
411
|
+
// bind the root select node (if any)
|
412
|
+
BoundStatement root_select;
|
413
|
+
if (stmt.column_order == InsertColumnOrder::INSERT_BY_NAME) {
|
414
|
+
if (values_list) {
|
415
|
+
throw BinderException("INSERT BY NAME can only be used when inserting from a SELECT statement");
|
416
|
+
}
|
417
|
+
if (!stmt.columns.empty()) {
|
418
|
+
throw BinderException("INSERT BY NAME cannot be combined with an explicit column list");
|
419
|
+
}
|
420
|
+
D_ASSERT(stmt.select_statement);
|
421
|
+
// INSERT BY NAME - generate the columns from the names of the SELECT statement
|
422
|
+
auto select_binder = Binder::CreateBinder(context, this);
|
423
|
+
root_select = select_binder->Bind(*stmt.select_statement);
|
424
|
+
MoveCorrelatedExpressions(*select_binder);
|
425
|
+
|
426
|
+
stmt.columns = root_select.names;
|
427
|
+
}
|
428
|
+
|
409
429
|
vector<LogicalIndex> named_column_map;
|
410
430
|
if (!stmt.columns.empty() || stmt.default_values) {
|
411
431
|
// insertion statement specifies column list
|
@@ -413,6 +433,10 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
|
|
413
433
|
// create a mapping of (list index) -> (column index)
|
414
434
|
case_insensitive_map_t<idx_t> column_name_map;
|
415
435
|
for (idx_t i = 0; i < stmt.columns.size(); i++) {
|
436
|
+
auto entry = column_name_map.insert(make_pair(stmt.columns[i], i));
|
437
|
+
if (!entry.second) {
|
438
|
+
throw BinderException("Duplicate column name \"%s\" in INSERT", stmt.columns[i]);
|
439
|
+
}
|
416
440
|
column_name_map[stmt.columns[i]] = i;
|
417
441
|
auto column_index = table.GetColumnIndex(stmt.columns[i]);
|
418
442
|
if (column_index.index == COLUMN_IDENTIFIER_ROW_ID) {
|
@@ -436,8 +460,8 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
|
|
436
460
|
}
|
437
461
|
}
|
438
462
|
} else {
|
439
|
-
//
|
440
|
-
//
|
463
|
+
// insert by position and no columns specified - insertion into all columns of the table
|
464
|
+
// intentionally don't populate 'column_index_map' as an indication of this
|
441
465
|
for (auto &col : table.GetColumns().Physical()) {
|
442
466
|
named_column_map.push_back(col.Logical());
|
443
467
|
insert->expected_types.push_back(col.Type());
|
@@ -454,7 +478,6 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
|
|
454
478
|
idx_t expected_columns = stmt.columns.empty() ? table.GetColumns().PhysicalColumnCount() : stmt.columns.size();
|
455
479
|
|
456
480
|
// special case: check if we are inserting from a VALUES statement
|
457
|
-
auto values_list = stmt.GetValuesList();
|
458
481
|
if (values_list) {
|
459
482
|
auto &expr_list = values_list->Cast<ExpressionListRef>();
|
460
483
|
expr_list.expected_types.resize(expected_columns);
|
@@ -487,10 +510,12 @@ BoundStatement Binder::Bind(InsertStatement &stmt) {
|
|
487
510
|
// parse select statement and add to logical plan
|
488
511
|
unique_ptr<LogicalOperator> root;
|
489
512
|
if (stmt.select_statement) {
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
513
|
+
if (stmt.column_order == InsertColumnOrder::INSERT_BY_POSITION) {
|
514
|
+
auto select_binder = Binder::CreateBinder(context, this);
|
515
|
+
root_select = select_binder->Bind(*stmt.select_statement);
|
516
|
+
MoveCorrelatedExpressions(*select_binder);
|
517
|
+
}
|
518
|
+
// inserting from a select - check if the column count matches
|
494
519
|
CheckInsertColumnCountMismatch(expected_columns, root_select.types.size(), !stmt.columns.empty(),
|
495
520
|
table.name.c_str());
|
496
521
|
|
@@ -344,10 +344,9 @@ unique_ptr<LogicalOperator> LogicalOperator::Deserialize(Deserializer &deseriali
|
|
344
344
|
case LogicalOperatorType::LOGICAL_ATTACH:
|
345
345
|
case LogicalOperatorType::LOGICAL_TRANSACTION:
|
346
346
|
case LogicalOperatorType::LOGICAL_DROP:
|
347
|
+
case LogicalOperatorType::LOGICAL_DETACH:
|
347
348
|
result = LogicalSimple::Deserialize(state, reader);
|
348
349
|
break;
|
349
|
-
case LogicalOperatorType::LOGICAL_DETACH:
|
350
|
-
throw SerializationException("Logical Detach does not support serialization");
|
351
350
|
case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR:
|
352
351
|
result = LogicalExtensionOperator::Deserialize(state, reader);
|
353
352
|
break;
|
@@ -7,43 +7,34 @@
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
9
|
void LogicalCreateIndex::Serialize(FieldWriter &writer) const {
|
10
|
-
|
11
10
|
writer.WriteOptional(info);
|
12
|
-
|
11
|
+
writer.WriteString(table.catalog.GetName());
|
12
|
+
writer.WriteString(table.schema.name);
|
13
|
+
writer.WriteString(table.name);
|
13
14
|
FunctionSerializer::SerializeBase<TableFunction>(writer, function, bind_data.get());
|
14
15
|
writer.WriteSerializableList(unbound_expressions);
|
15
|
-
|
16
|
-
writer.Finalize();
|
17
16
|
}
|
18
17
|
|
19
18
|
unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
20
|
-
|
21
19
|
auto &context = state.gstate.context;
|
22
|
-
auto catalog_info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
|
23
|
-
|
24
|
-
auto &table =
|
25
|
-
Catalog::GetEntry<TableCatalogEntry>(context, catalog_info->catalog, catalog_info->schema, catalog_info->table);
|
26
|
-
auto unbound_expressions = reader.ReadRequiredSerializableList<Expression>(state.gstate);
|
27
|
-
|
28
|
-
auto create_info = reader.ReadOptional<CreateInfo>(nullptr);
|
29
|
-
if (create_info->type != CatalogType::INDEX_ENTRY) {
|
30
|
-
throw InternalException("Unexpected type: '%s', expected '%s'", CatalogTypeToString(create_info->type),
|
31
|
-
CatalogTypeToString(CatalogType::INDEX_ENTRY));
|
32
|
-
}
|
33
|
-
|
34
|
-
CreateInfo *raw_create_info_ptr = create_info.release();
|
35
|
-
CreateIndexInfo *raw_create_index_info_ptr = static_cast<CreateIndexInfo *>(raw_create_info_ptr);
|
36
|
-
unique_ptr<CreateIndexInfo> uptr_create_index_info = unique_ptr<CreateIndexInfo> {raw_create_index_info_ptr};
|
37
|
-
auto info = unique_ptr<CreateIndexInfo> {static_cast<CreateIndexInfo *>(create_info.release())};
|
38
20
|
|
21
|
+
auto info = reader.ReadOptional<CreateInfo>(nullptr);
|
22
|
+
auto catalog = reader.ReadRequired<string>();
|
23
|
+
auto schema = reader.ReadRequired<string>();
|
24
|
+
auto table_name = reader.ReadRequired<string>();
|
39
25
|
unique_ptr<FunctionData> bind_data;
|
40
26
|
bool has_deserialize;
|
41
27
|
auto function = FunctionSerializer::DeserializeBaseInternal<TableFunction, TableFunctionCatalogEntry>(
|
42
28
|
reader, state.gstate, CatalogType::TABLE_FUNCTION_ENTRY, bind_data, has_deserialize);
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
29
|
+
auto unbound_expressions = reader.ReadRequiredSerializableList<Expression>(state.gstate);
|
30
|
+
if (info->type != CatalogType::INDEX_ENTRY) {
|
31
|
+
throw InternalException("Unexpected type: '%s', expected '%s'", CatalogTypeToString(info->type),
|
32
|
+
CatalogTypeToString(CatalogType::INDEX_ENTRY));
|
33
|
+
}
|
34
|
+
auto index_info = unique_ptr_cast<CreateInfo, CreateIndexInfo>(std::move(info));
|
35
|
+
auto &table = Catalog::GetEntry<TableCatalogEntry>(context, catalog, schema, table_name);
|
36
|
+
return make_uniq<LogicalCreateIndex>(std::move(bind_data), std::move(index_info), std::move(unbound_expressions),
|
37
|
+
table, std::move(function));
|
47
38
|
}
|
48
39
|
|
49
40
|
} // namespace duckdb
|
@@ -25,6 +25,16 @@ void LogicalInsert::Serialize(FieldWriter &writer) const {
|
|
25
25
|
writer.WriteField(return_chunk);
|
26
26
|
writer.WriteSerializableList(bound_defaults);
|
27
27
|
writer.WriteField(action_type);
|
28
|
+
writer.WriteRegularSerializableList(expected_set_types);
|
29
|
+
writer.WriteList<column_t>(on_conflict_filter);
|
30
|
+
writer.WriteOptional(on_conflict_condition);
|
31
|
+
writer.WriteOptional(do_update_condition);
|
32
|
+
writer.WriteIndexList(set_columns);
|
33
|
+
writer.WriteRegularSerializableList(set_types);
|
34
|
+
writer.WriteField(excluded_table_index);
|
35
|
+
writer.WriteList<column_t>(columns_to_fetch);
|
36
|
+
writer.WriteList<column_t>(source_columns);
|
37
|
+
writer.WriteSerializableList<Expression>(expressions);
|
28
38
|
}
|
29
39
|
|
30
40
|
unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
|
@@ -42,6 +52,16 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
|
|
42
52
|
auto return_chunk = reader.ReadRequired<bool>();
|
43
53
|
auto bound_defaults = reader.ReadRequiredSerializableList<Expression>(state.gstate);
|
44
54
|
auto action_type = reader.ReadRequired<OnConflictAction>();
|
55
|
+
auto expected_set_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
56
|
+
auto on_conflict_filter = reader.ReadRequiredSet<column_t, unordered_set<column_t>>();
|
57
|
+
auto on_conflict_condition = reader.ReadOptional<Expression>(nullptr, state.gstate);
|
58
|
+
auto do_update_condition = reader.ReadOptional<Expression>(nullptr, state.gstate);
|
59
|
+
auto set_columns = reader.ReadRequiredIndexList<PhysicalIndex>();
|
60
|
+
auto set_types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
61
|
+
auto excluded_table_index = reader.ReadRequired<idx_t>();
|
62
|
+
auto columns_to_fetch = reader.ReadRequiredList<column_t>();
|
63
|
+
auto source_columns = reader.ReadRequiredList<column_t>();
|
64
|
+
auto expressions = reader.ReadRequiredSerializableList<Expression>(state.gstate);
|
45
65
|
|
46
66
|
auto &catalog = Catalog::GetCatalog(context, info->catalog);
|
47
67
|
|
@@ -54,6 +74,16 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
|
|
54
74
|
result->expected_types = expected_types;
|
55
75
|
result->bound_defaults = std::move(bound_defaults);
|
56
76
|
result->action_type = action_type;
|
77
|
+
result->expected_set_types = std::move(expected_set_types);
|
78
|
+
result->on_conflict_filter = std::move(on_conflict_filter);
|
79
|
+
result->on_conflict_condition = std::move(on_conflict_condition);
|
80
|
+
result->do_update_condition = std::move(do_update_condition);
|
81
|
+
result->set_columns = std::move(set_columns);
|
82
|
+
result->set_types = std::move(set_types);
|
83
|
+
result->excluded_table_index = excluded_table_index;
|
84
|
+
result->columns_to_fetch = std::move(columns_to_fetch);
|
85
|
+
result->source_columns = std::move(source_columns);
|
86
|
+
result->expressions = std::move(expressions);
|
57
87
|
return std::move(result);
|
58
88
|
}
|
59
89
|
|