Skip to content

Commit ece1dc0

Browse files
committed
Fix for not updating any columns
1 parent 3d6044a commit ece1dc0

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/storage/postgres_merge_into.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ unique_ptr<MergeIntoOperator> PostgresPlanMergeIntoAction(PostgresCatalog &catal
3232

3333
switch (action.action_type) {
3434
case MergeActionType::MERGE_UPDATE: {
35+
if (action.columns.empty()) {
36+
// not updating any columns
37+
result->action_type = MergeActionType::MERGE_DO_NOTHING;
38+
break;
39+
}
3540
LogicalUpdate update(op.table);
3641
for (auto &def : op.bound_defaults) {
3742
update.bound_defaults.push_back(def->Copy());

src/storage/postgres_update.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@ string CreateUpdateTable(const string &name, PostgresTableEntry &table, const ve
4646
result = "CREATE LOCAL TEMPORARY TABLE " + PostgresUtils::QuotePostgresIdentifier(name);
4747
result += "(";
4848
for (idx_t i = 0; i < index.size(); i++) {
49-
if (i > 0) {
50-
result += ", ";
51-
}
5249
auto &column_name = table.postgres_names[index[i].index];
5350
auto &col = table.GetColumn(LogicalIndex(index[i].index));
5451
result += KeywordHelper::WriteQuoted(column_name, '"');
5552
result += " ";
5653
result += PostgresUtils::TypeToString(col.GetType());
54+
result += ", ";
5755
}
58-
result += ", __page_id_string VARCHAR) ON COMMIT DROP;";
56+
result += "__page_id_string VARCHAR) ON COMMIT DROP;";
5957
return result;
6058
}
6159

test/sql/storage/attach_merge.test

Whitespace-only changes.

test/sql/storage/attach_on_conflict.test

Whitespace-only changes.

0 commit comments

Comments
 (0)