pqb 0.38.7 → 0.39.0

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
@@ -4510,8 +4510,10 @@ const maybeUnNameColumn = (column, isSubQuery) => {
4510
4510
  return isSubQuery && (column == null ? void 0 : column.data.name) ? setColumnData(column, "name", void 0) : column;
4511
4511
  };
4512
4512
  function _querySelect(q, args) {
4513
+ var _a, _b;
4513
4514
  const len = args.length;
4514
4515
  if (!len) {
4516
+ (_b = (_a = q.q).select) != null ? _b : _a.select = [];
4515
4517
  return q;
4516
4518
  }
4517
4519
  const as = q.q.as || q.table;
@@ -4804,7 +4806,9 @@ function queryJson(self, coalesce) {
4804
4806
  }
4805
4807
 
4806
4808
  const pushSelectSql = (ctx, table, query, quotedAs) => {
4807
- ctx.sql.push(selectToSql(ctx, table, query, quotedAs));
4809
+ const sql = selectToSql(ctx, table, query, quotedAs);
4810
+ if (sql)
4811
+ ctx.sql.push(sql);
4808
4812
  };
4809
4813
  const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect) => {
4810
4814
  var _a, _b;
@@ -4915,7 +4919,7 @@ const selectToSql = (ctx, table, query, quotedAs, hookSelect = query.hookSelect)
4915
4919
  list.push(sql);
4916
4920
  }
4917
4921
  }
4918
- return list.length ? list.join(", ") : selectAllSql(table, query, quotedAs);
4922
+ return list.length ? list.join(", ") : query.select ? "" : selectAllSql(table, query, quotedAs);
4919
4923
  };
4920
4924
  function selectedObjectToSQL(ctx, quotedAs, item) {
4921
4925
  const sql = item.toSQL(ctx, quotedAs);