squirreling 0.12.3 → 0.12.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/plan/plan.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squirreling",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "Squirreling Async SQL Engine",
5
5
  "author": "Hyperparam",
6
6
  "homepage": "https://hyperparam.app",
package/src/plan/plan.js CHANGED
@@ -48,7 +48,7 @@ export function planStatement({ stmt, ctePlans, cteColumns, tables, parentColumn
48
48
  return planStatement({ stmt: stmt.query, ctePlans, cteColumns, tables, parentColumns, outerScope })
49
49
  }
50
50
  if (stmt.type === 'compound') {
51
- return planSetOperation({ compound: stmt, ctePlans, cteColumns, tables })
51
+ return planSetOperation({ compound: stmt, ctePlans, cteColumns, tables, parentColumns })
52
52
  }
53
53
  return planSelect({ select: stmt, ctePlans, cteColumns, tables, parentColumns, outerScope })
54
54
  }
@@ -61,11 +61,12 @@ export function planStatement({ stmt, ctePlans, cteColumns, tables, parentColumn
61
61
  * @param {Map<string, QueryPlan>} [options.ctePlans]
62
62
  * @param {Map<string, string[]>} [options.cteColumns]
63
63
  * @param {Record<string, AsyncDataSource>} [options.tables]
64
+ * @param {IdentifierNode[]} [options.parentColumns] - columns needed by the parent query
64
65
  * @returns {QueryPlan}
65
66
  */
66
- function planSetOperation({ compound, ctePlans, cteColumns, tables }) {
67
- const left = planStatement({ stmt: compound.left, ctePlans, cteColumns, tables })
68
- const right = planStatement({ stmt: compound.right, ctePlans, cteColumns, tables })
67
+ function planSetOperation({ compound, ctePlans, cteColumns, tables, parentColumns }) {
68
+ const left = planStatement({ stmt: compound.left, ctePlans, cteColumns, tables, parentColumns })
69
+ const right = planStatement({ stmt: compound.right, ctePlans, cteColumns, tables, parentColumns })
69
70
  const leftColumns = inferStatementColumns({ stmt: compound.left, cteColumns, tables })
70
71
  const rightColumns = inferStatementColumns({ stmt: compound.right, cteColumns, tables })
71
72