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