Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/duckdb/generated_extension_loader_package_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int32_t duckdb_extension_core_functions_describe(duckdb_extension_descriptor *de
descriptor->version = 1;
descriptor->name = "core_functions";
descriptor->extension_version = EXT_VERSION_CORE_FUNCTIONS;
descriptor->api_version = "v2.0.2-alpha58209";
descriptor->api_version = "v2.0.2-alpha58727";
descriptor->entry_cpp = (void (*)(void))core_functions_duckdb_cpp_init;
return 0;
}
Expand Down Expand Up @@ -78,7 +78,7 @@ int32_t duckdb_extension_parquet_describe(duckdb_extension_descriptor *descripto
descriptor->version = 1;
descriptor->name = "parquet";
descriptor->extension_version = EXT_VERSION_PARQUET;
descriptor->api_version = "v2.0.2-alpha58209";
descriptor->api_version = "v2.0.2-alpha58727";
descriptor->entry_cpp = (void (*)(void))parquet_duckdb_cpp_init;
return 0;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ int32_t duckdb_extension_icu_describe(duckdb_extension_descriptor *descriptor) {
descriptor->version = 1;
descriptor->name = "icu";
descriptor->extension_version = EXT_VERSION_ICU;
descriptor->api_version = "v2.0.2-alpha58209";
descriptor->api_version = "v2.0.2-alpha58727";
descriptor->entry_cpp = (void (*)(void))icu_duckdb_cpp_init;
return 0;
}
Expand Down Expand Up @@ -144,7 +144,7 @@ int32_t duckdb_extension_json_describe(duckdb_extension_descriptor *descriptor)
descriptor->version = 1;
descriptor->name = "json";
descriptor->extension_version = EXT_VERSION_JSON;
descriptor->api_version = "v2.0.2-alpha58209";
descriptor->api_version = "v2.0.2-alpha58727";
descriptor->entry_cpp = (void (*)(void))json_duckdb_cpp_init;
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ SinkResultType PhysicalUpdate::Sink(ExecutionContext &context, DataChunk &chunk,
// The update chunk now contains exactly those rows that we are deleting.
Vector del_row_ids(Vector::Ref(row_ids));
if (update_count != update_chunk.size()) {
// like an in-place update, check every match, also those that are not written
ConstraintState constraint_state(tableref, bound_constraints);
table.VerifyUpdateConstraints(constraint_state, context.client, update_chunk, columns);
update_chunk.Slice(sel, update_count);
del_row_ids.Slice(row_ids, sel, update_count);
}
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "2-alpha58209"
#define DUCKDB_PATCH_VERSION "2-alpha58727"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 0
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 2
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v2.0.2-alpha58209"
#define DUCKDB_VERSION "v2.0.2-alpha58727"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "16cfccddc4"
#define DUCKDB_SOURCE_ID "ea0a0e9258"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/include/duckdb/storage/data_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ class DataTable : public enable_shared_from_this<DataTable> {
//! Verify constraints with a chunk from the Append containing all columns of the table
void VerifyAppendConstraints(ConstraintState &constraint_state, ClientContext &context, DataChunk &chunk,
optional_ptr<LocalTableStorage> local_storage, optional_ptr<ConflictManager> manager);
//! Verify the NOT NULL and CHECK constraints of a chunk from the Update containing only the specified column_ids
void VerifyUpdateConstraints(ConstraintState &state, ClientContext &context, DataChunk &chunk,
const vector<PhysicalIndex> &column_ids);

shared_ptr<DataTableInfo> &GetDataTableInfo();

Expand Down Expand Up @@ -299,9 +302,6 @@ class DataTable : public enable_shared_from_this<DataTable> {
//! Verify the new added constraints against current persistent&local data
void VerifyNewConstraint(LocalStorage &local_storage, DataTable &parent, const BoundConstraint &constraint);

//! Verify constraints with a chunk from the Update containing only the specified column_ids
void VerifyUpdateConstraints(ConstraintState &state, ClientContext &context, DataChunk &chunk,
const vector<PhysicalIndex> &column_ids);
//! Verify constraints with a chunk from the Delete containing all columns of the table
void VerifyDeleteConstraints(optional_ptr<LocalTableStorage> storage, TableDeleteState &state,
ClientContext &context, DataChunk &chunk);
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/storage/data_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,9 +1479,6 @@ void DataTable::VerifyUpdateConstraints(ConstraintState &state, ClientContext &c
throw NotImplementedException("Constraint type not implemented!");
}
}
// Ensure that we never call UPDATE for indexed columns.
// Instead, we must rewrite these updates into DELETE + INSERT.
info->indexes.VerifyUpdate(column_ids);
}

unique_ptr<TableUpdateState> DataTable::InitializeUpdate(TableCatalogEntry &table, ClientContext &context,
Expand Down Expand Up @@ -1512,6 +1509,9 @@ void DataTable::Update(TableUpdateState &state, ClientContext &context, DuckTabl

// first verify that no constraints are violated
VerifyUpdateConstraints(*state.constraint_state, context, updates, column_ids);
// Ensure that we never call UPDATE for indexed columns.
// Instead, we must rewrite these updates into DELETE + INSERT.
info->indexes.VerifyUpdate(column_ids);

// now perform the actual update
Vector max_row_id_vec(Value::BIGINT(MAX_ROW_ID), count_t(count));
Expand Down
4 changes: 3 additions & 1 deletion src/duckdb/src/storage/table/update_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,9 @@ static idx_t SortSelectionVector(SelectionVector &sel, idx_t count, row_t *ids)
for (idx_t i = 0; i < count; i++) {
sorted_sel.set_index(i, sel.get_index(i));
}
std::sort(sorted_sel.data(), sorted_sel.data() + count, [&](sel_t l, sel_t r) { return ids[l] < ids[r]; });
// every column keeps the last entry of a repeated row id, so a row never mixes values of different entries
std::sort(sorted_sel.data(), sorted_sel.data() + count,
[&](sel_t l, sel_t r) { return ids[l] == ids[r] ? l > r : ids[l] < ids[r]; });
// eliminate any duplicates
idx_t pos = 1;
for (idx_t i = 1; i < count; i++) {
Expand Down
Loading