pqb 0.43.2 → 0.43.3

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
@@ -5763,9 +5763,10 @@ const makeInsertSql = (ctx, q, query, quotedAs) => {
5763
5763
  }
5764
5764
  pushWhereStatementSql(ctx, q, query, quotedAs);
5765
5765
  let returning;
5766
- if (inCTE?.selectNum) {
5766
+ if (inCTE) {
5767
+ const select = inCTE.returning?.select;
5767
5768
  returning = {
5768
- select: inCTE.returning?.select ? "1, " + inCTE.returning.select : "1",
5769
+ select: inCTE.selectNum || !select ? select ? "1, " + select : "1" : select,
5769
5770
  hookSelect: inCTE.returning?.hookSelect
5770
5771
  };
5771
5772
  } else {
@@ -5961,8 +5962,6 @@ const makeReturningSql = (ctx, q, data, quotedAs, hookSelectI, addHookSelectI) =
5961
5962
  let sql;
5962
5963
  if (tempSelect?.size || select?.length) {
5963
5964
  sql = selectToSql(ctx, q, data, quotedAs, tempSelect, void 0, true);
5964
- } else if (addHookSelectI) {
5965
- sql = "1";
5966
5965
  }
5967
5966
  return { select: sql, hookSelect: tempSelect };
5968
5967
  };
@@ -5986,7 +5985,7 @@ const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect,
5986
5985
  query,
5987
5986
  quotedAs
5988
5987
  );
5989
- return query.inCTE.selectNum ? select ? "0, " + select : "0" : select || "";
5988
+ return query.inCTE.selectNum || !select ? select ? "0, " + select : "0" : select;
5990
5989
  }
5991
5990
  let selected;
5992
5991
  const list = [];
@@ -6482,7 +6481,7 @@ const pushUpdateReturning = (ctx, table, query, quotedAs, keyword) => {
6482
6481
  1,
6483
6482
  inCTE && 2
6484
6483
  );
6485
- const s = inCTE?.selectNum ? select ? "0, " + select : "0" : select;
6484
+ const s = inCTE && (inCTE.selectNum || !select) ? select ? "0, " + select : "0" : select;
6486
6485
  if (s) ctx.sql.push(keyword, s);
6487
6486
  return hookSelect;
6488
6487
  };