@crvouga/mockingbird-service-postgres 3.9.0 → 3.10.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/CHANGELOG.md +7 -1
- package/COMPATIBILITY.md +1 -1
- package/dist/admin.js +43 -2
- package/dist/admin.js.map +2 -2
- package/dist/index.js +44 -3
- package/dist/index.js.map +2 -2
- package/dist/server.js +43 -2
- package/dist/server.js.map +2 -2
- package/dist/unstable.js +43 -2
- package/dist/unstable.js.map +2 -2
- package/dist/wire/cli.js +44 -3
- package/dist/wire/cli.js.map +2 -2
- package/dist/wire/index.js +43 -2
- package/dist/wire/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13442,6 +13442,45 @@ function validateCaseSubExpr(ctx, scope, e) {
|
|
|
13442
13442
|
return;
|
|
13443
13443
|
}
|
|
13444
13444
|
}
|
|
13445
|
+
function caseBranchType(ctx, scope, e) {
|
|
13446
|
+
switch (e.type) {
|
|
13447
|
+
case "null_lit":
|
|
13448
|
+
case "string_lit":
|
|
13449
|
+
return UNKNOWN;
|
|
13450
|
+
case "number_lit":
|
|
13451
|
+
return numberLitValue(e.raw).t;
|
|
13452
|
+
case "bool_lit":
|
|
13453
|
+
return "bool";
|
|
13454
|
+
case "colref":
|
|
13455
|
+
return scope.lookupColumn(e.parts)?.t ?? null;
|
|
13456
|
+
case "cast":
|
|
13457
|
+
return resolveTypeName(ctx.state, e.target).column.id;
|
|
13458
|
+
case "collate":
|
|
13459
|
+
return caseBranchType(ctx, scope, e.expr);
|
|
13460
|
+
case "binop": {
|
|
13461
|
+
const left = caseBranchType(ctx, scope, e.left);
|
|
13462
|
+
if (left !== "json" && left !== "jsonb") return null;
|
|
13463
|
+
if (e.op === "->" || e.op === "#>") return left;
|
|
13464
|
+
if (e.op === "->>" || e.op === "#>>") return "text";
|
|
13465
|
+
return null;
|
|
13466
|
+
}
|
|
13467
|
+
case "case": {
|
|
13468
|
+
let type = UNKNOWN;
|
|
13469
|
+
const branches = [...e.whens.map((w) => w.then), ...e.elseExpr ? [e.elseExpr] : []];
|
|
13470
|
+
for (const branch of branches) {
|
|
13471
|
+
const next = caseBranchType(ctx, scope, branch);
|
|
13472
|
+
if (next === null) return null;
|
|
13473
|
+
if (next === UNKNOWN) continue;
|
|
13474
|
+
const unified = unifyTypes(type, next);
|
|
13475
|
+
if (unified === null) return null;
|
|
13476
|
+
type = unified;
|
|
13477
|
+
}
|
|
13478
|
+
return type;
|
|
13479
|
+
}
|
|
13480
|
+
default:
|
|
13481
|
+
return null;
|
|
13482
|
+
}
|
|
13483
|
+
}
|
|
13445
13484
|
function evalCase(ctx, scope, e) {
|
|
13446
13485
|
validateSearchedCaseTree(ctx, scope, e);
|
|
13447
13486
|
let chosen = null;
|
|
@@ -13465,8 +13504,10 @@ function evalCase(ctx, scope, e) {
|
|
|
13465
13504
|
}
|
|
13466
13505
|
}
|
|
13467
13506
|
const resultExpr = chosen ?? e.elseExpr;
|
|
13468
|
-
|
|
13469
|
-
|
|
13507
|
+
const result = resultExpr === null ? tv(UNKNOWN, null) : evalExpr(ctx, scope, resultExpr);
|
|
13508
|
+
if (result.t !== UNKNOWN) return result;
|
|
13509
|
+
const type = caseBranchType(ctx, scope, e);
|
|
13510
|
+
return type !== null && type !== UNKNOWN ? castTo(ctx, result, type, {}) : result;
|
|
13470
13511
|
}
|
|
13471
13512
|
function evalIn(ctx, scope, e) {
|
|
13472
13513
|
const left = evalExpr(ctx, scope, e.left);
|
|
@@ -30768,7 +30809,7 @@ function analyzeSchema(sql, options = {}) {
|
|
|
30768
30809
|
const diagnosticLimit = bounded(options.maxDiagnostics, 100, 1e3);
|
|
30769
30810
|
const report = {
|
|
30770
30811
|
engine: "mockingbird-postgres",
|
|
30771
|
-
version: true ? "3.
|
|
30812
|
+
version: true ? "3.10.0" : "source-tree",
|
|
30772
30813
|
statements: 0,
|
|
30773
30814
|
accepted: 0,
|
|
30774
30815
|
compatible: null,
|