@minnowdb/core 0.6.7 → 0.6.8

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.
@@ -8281,6 +8281,34 @@ function desugarFullJoin(parts, nextSequence) {
8281
8281
  if (join.on !== undefined) {
8282
8282
  throw new TypeError("FULL JOIN requires a single equality ON condition");
8283
8283
  }
8284
+ // The UNION ALL this desugars into resolves ORDER BY against the compound's output columns,
8285
+ // where the branches' table aliases no longer exist. Qualified references that name a select
8286
+ // item are rewritten to its output alias, and everything else — expressions, and columns the
8287
+ // select list does not carry — takes the shared hidden-column desugar, which re-enters this
8288
+ // function with alias-only ordering.
8289
+ const outputAlias = (reference) => {
8290
+ const exact = parts.select.find((item) => item.alias === reference ||
8291
+ (item.expression.kind === "column" && item.expression.reference === reference));
8292
+ if (exact !== undefined)
8293
+ return exact.alias;
8294
+ const bare = reference.split(".").at(-1) ?? reference;
8295
+ return parts.select.find((item) => item.alias === bare)?.alias;
8296
+ };
8297
+ parts = {
8298
+ ...parts,
8299
+ orderBy: parts.orderBy.map((order) => {
8300
+ if (order.expression.kind !== "column" || !order.expression.reference.includes(".")) {
8301
+ return order;
8302
+ }
8303
+ const alias = outputAlias(order.expression.reference);
8304
+ if (alias === undefined)
8305
+ return order;
8306
+ return { ...order, expression: { kind: "column", reference: alias } };
8307
+ }),
8308
+ };
8309
+ if (parts.orderBy.some((order) => orderNeedsHiddenColumn(order.expression, parts))) {
8310
+ return assembleOrderByExpressionBlock(parts, nextSequence);
8311
+ }
8284
8312
  // `on` is absent here: the guard above rejected non-equi conditions.
8285
8313
  const { full, kind, left, right, ...joinSource } = join;
8286
8314
  void full;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minnowdb/core",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "A columnar SQL database for the browser: PostgreSQL-style SQL over durable IndexedDB or OPFS data, with no server or WebAssembly module.",
5
5
  "license": "MIT",
6
6
  "author": "Eric Wilhite",