pqb 0.31.6 → 0.31.7

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/dist/index.js CHANGED
@@ -4385,20 +4385,20 @@ const pushInsertSql = (ctx, q, query, quotedAs) => {
4385
4385
  if (merge) {
4386
4386
  if (typeof merge === "string") {
4387
4387
  const name = ((_c = shape[merge]) == null ? void 0 : _c.data.name) || merge;
4388
- sql = `"${name}" = excluded."${name}"`;
4388
+ sql = `DO UPDATE SET "${name}" = excluded."${name}"`;
4389
4389
  } else if ("except" in merge) {
4390
4390
  sql = mergeColumnsSql(columns, quotedColumns, target, merge.except);
4391
4391
  } else {
4392
- sql = merge.reduce((sql2, item, i) => {
4392
+ sql = `DO UPDATE SET ${merge.reduce((sql2, item, i) => {
4393
4393
  var _a2;
4394
4394
  const name = ((_a2 = shape[item]) == null ? void 0 : _a2.data.name) || item;
4395
4395
  return sql2 + (i ? ", " : "") + `"${name}" = excluded."${name}"`;
4396
- }, "");
4396
+ }, "")}`;
4397
4397
  }
4398
4398
  } else {
4399
4399
  sql = mergeColumnsSql(columns, quotedColumns, target);
4400
4400
  }
4401
- ctx.sql.push("DO UPDATE SET", sql);
4401
+ ctx.sql.push(sql);
4402
4402
  } else if (query.onConflict.set) {
4403
4403
  let sql;
4404
4404
  const { set } = query.onConflict;
@@ -4439,7 +4439,7 @@ const mergeColumnsSql = (columns, quotedColumns2, target, except) => {
4439
4439
  notExcluded.push(quotedColumns2[i]);
4440
4440
  }
4441
4441
  }
4442
- return notExcluded.map((column) => `${column} = excluded.${column}`).join(", ");
4442
+ return notExcluded.length ? `DO UPDATE SET ${notExcluded.map((column) => `${column} = excluded.${column}`).join(", ")}` : "DO NOTHING";
4443
4443
  };
4444
4444
  const encodeRow = (ctx, q, QueryClass, row, runtimeDefaults, quotedAs) => {
4445
4445
  const arr = row.map((value) => {