@dbsp/adapter-pgsql 7.1.0 → 7.1.1
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.
|
@@ -12931,6 +12931,15 @@ function assertSafeOperator(op2, opts) {
|
|
|
12931
12931
|
);
|
|
12932
12932
|
}
|
|
12933
12933
|
}
|
|
12934
|
+
function expressionNamedColumnRef(name, ctx) {
|
|
12935
|
+
const dotIdx = name.indexOf(".");
|
|
12936
|
+
if (dotIdx === -1) return expressionUnqualifiedColumnRef(name, ctx);
|
|
12937
|
+
return expressionQualifiedColumnRef(
|
|
12938
|
+
name.slice(dotIdx + 1),
|
|
12939
|
+
name.slice(0, dotIdx),
|
|
12940
|
+
ctx
|
|
12941
|
+
);
|
|
12942
|
+
}
|
|
12934
12943
|
function compileExpressionIntent(intent, ctx, state) {
|
|
12935
12944
|
const kind = intent.kind;
|
|
12936
12945
|
switch (kind) {
|
|
@@ -12961,7 +12970,7 @@ function compileExpressionIntent(intent, ctx, state) {
|
|
|
12961
12970
|
(arg) => compileExpressionIntent(arg, ctx, state)
|
|
12962
12971
|
);
|
|
12963
12972
|
const orderByNodes = i.aggOrderBy && i.aggOrderBy.length > 0 ? i.aggOrderBy.map((ob) => {
|
|
12964
|
-
const colNode =
|
|
12973
|
+
const colNode = expressionNamedColumnRef(ob.field, ctx);
|
|
12965
12974
|
return sortBy(colNode, ob.direction === "desc" ? "DESC" : "ASC");
|
|
12966
12975
|
}) : void 0;
|
|
12967
12976
|
const filterNode = i.filter ? ctx.compileCustomFnFilter?.(i.filter, ctx, state) : void 0;
|
|
@@ -12978,13 +12987,7 @@ function compileExpressionIntent(intent, ctx, state) {
|
|
|
12978
12987
|
}
|
|
12979
12988
|
case "ref": {
|
|
12980
12989
|
const i = intent;
|
|
12981
|
-
|
|
12982
|
-
if (dotIdx !== -1) {
|
|
12983
|
-
const table2 = i.column.slice(0, dotIdx);
|
|
12984
|
-
const col = i.column.slice(dotIdx + 1);
|
|
12985
|
-
return expressionQualifiedColumnRef(col, table2, ctx);
|
|
12986
|
-
}
|
|
12987
|
-
return expressionUnqualifiedColumnRef(i.column, ctx);
|
|
12990
|
+
return expressionNamedColumnRef(i.column, ctx);
|
|
12988
12991
|
}
|
|
12989
12992
|
case "param": {
|
|
12990
12993
|
const i = intent;
|
|
@@ -19271,13 +19274,22 @@ var prefixedRelationColumnHandler = {
|
|
|
19271
19274
|
|
|
19272
19275
|
// src/handlers/expression/window.ts
|
|
19273
19276
|
var WINDOW_FRAME_DEFAULT = 1034;
|
|
19277
|
+
function windowColumnRef(name, ctx) {
|
|
19278
|
+
const dotIdx = name.indexOf(".");
|
|
19279
|
+
if (dotIdx === -1) return expressionColumnRef(name, ctx);
|
|
19280
|
+
return expressionQualifiedColumnRef(
|
|
19281
|
+
name.slice(dotIdx + 1),
|
|
19282
|
+
name.slice(0, dotIdx),
|
|
19283
|
+
ctx
|
|
19284
|
+
);
|
|
19285
|
+
}
|
|
19274
19286
|
function isWindowOrderBy(orderBy) {
|
|
19275
19287
|
return Array.isArray(orderBy) && orderBy.every(
|
|
19276
19288
|
(item) => typeof item === "object" && item !== null && "column" in item && typeof item.column === "string"
|
|
19277
19289
|
);
|
|
19278
19290
|
}
|
|
19279
19291
|
function buildSortBy(column2, direction, ctx) {
|
|
19280
|
-
const colRef =
|
|
19292
|
+
const colRef = windowColumnRef(column2, ctx);
|
|
19281
19293
|
const sortBy2 = {
|
|
19282
19294
|
node: colRef,
|
|
19283
19295
|
sortby_dir: direction === "DESC" ? "SORTBY_DESC" : "SORTBY_ASC",
|
|
@@ -19292,7 +19304,7 @@ function buildWindowDef(decision, ctx) {
|
|
|
19292
19304
|
const windowDef = { frameOptions: WINDOW_FRAME_DEFAULT };
|
|
19293
19305
|
if (partition && partition.length > 0) {
|
|
19294
19306
|
windowDef.partitionClause = partition.map(
|
|
19295
|
-
(col) =>
|
|
19307
|
+
(col) => windowColumnRef(col, ctx)
|
|
19296
19308
|
);
|
|
19297
19309
|
}
|
|
19298
19310
|
if (orderBy && orderBy.length > 0) {
|
|
@@ -19351,7 +19363,7 @@ function createLagLeadHandler(funcName, types) {
|
|
|
19351
19363
|
if (!column2) {
|
|
19352
19364
|
throw new Error(`${upperName} requires a column`);
|
|
19353
19365
|
}
|
|
19354
|
-
const colRef =
|
|
19366
|
+
const colRef = windowColumnRef(column2, ctx);
|
|
19355
19367
|
const args = [colRef];
|
|
19356
19368
|
const offset = decision.args?.[0] ?? 1;
|
|
19357
19369
|
args.push(bindParameter(unwrapParamIntent(offset), state));
|
|
@@ -19373,7 +19385,7 @@ function createColumnWindowHandler(funcName, types) {
|
|
|
19373
19385
|
if (!column2) {
|
|
19374
19386
|
throw new Error(`${upperName} requires a column`);
|
|
19375
19387
|
}
|
|
19376
|
-
const colRef =
|
|
19388
|
+
const colRef = windowColumnRef(column2, ctx);
|
|
19377
19389
|
return buildWindowFunction(funcName, [colRef], decision, ctx);
|
|
19378
19390
|
}
|
|
19379
19391
|
};
|
|
@@ -19408,7 +19420,7 @@ var genericWindowHandler = {
|
|
|
19408
19420
|
}
|
|
19409
19421
|
const args = [];
|
|
19410
19422
|
if (decision.column) {
|
|
19411
|
-
args.push(
|
|
19423
|
+
args.push(windowColumnRef(decision.column, ctx));
|
|
19412
19424
|
}
|
|
19413
19425
|
if (decision.args && Array.isArray(decision.args)) {
|
|
19414
19426
|
for (const arg of decision.args) {
|
|
@@ -59268,4 +59280,4 @@ export {
|
|
|
59268
59280
|
planPgTransitionRun,
|
|
59269
59281
|
applyPgTransitionRun
|
|
59270
59282
|
};
|
|
59271
|
-
//# sourceMappingURL=chunk-
|
|
59283
|
+
//# sourceMappingURL=chunk-XFAIB2BL.js.map
|