@quereus/quereus 4.5.0 → 4.7.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/README.md +5 -4
- package/dist/src/common/errors.d.ts +17 -0
- package/dist/src/common/errors.d.ts.map +1 -1
- package/dist/src/common/errors.js +21 -0
- package/dist/src/common/errors.js.map +1 -1
- package/dist/src/core/database-assertions.d.ts +4 -3
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +44 -14
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-events.d.ts +161 -1
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +307 -5
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-internal.d.ts +5 -2
- package/dist/src/core/database-internal.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.js +33 -4
- package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
- package/dist/src/core/database-materialized-views-plans.d.ts +12 -2
- package/dist/src/core/database-materialized-views-plans.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.d.ts +46 -0
- package/dist/src/core/database-materialized-views.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.js +75 -4
- package/dist/src/core/database-materialized-views.js.map +1 -1
- package/dist/src/core/database-transaction.d.ts +9 -0
- package/dist/src/core/database-transaction.d.ts.map +1 -1
- package/dist/src/core/database-transaction.js +9 -0
- package/dist/src/core/database-transaction.js.map +1 -1
- package/dist/src/core/database.d.ts +16 -2
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +56 -15
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/derived-row-validator.d.ts.map +1 -1
- package/dist/src/core/derived-row-validator.js +7 -1
- package/dist/src/core/derived-row-validator.js.map +1 -1
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +15 -5
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/emit/ast-stringify.d.ts +18 -2
- package/dist/src/emit/ast-stringify.d.ts.map +1 -1
- package/dist/src/emit/ast-stringify.js +22 -4
- package/dist/src/emit/ast-stringify.js.map +1 -1
- package/dist/src/func/builtins/aggregate.js +11 -11
- package/dist/src/func/builtins/aggregate.js.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.js +15 -85
- package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
- package/dist/src/func/builtins/conversion.d.ts.map +1 -1
- package/dist/src/func/builtins/conversion.js +10 -9
- package/dist/src/func/builtins/conversion.js.map +1 -1
- package/dist/src/func/builtins/datetime.d.ts.map +1 -1
- package/dist/src/func/builtins/datetime.js +28 -10
- package/dist/src/func/builtins/datetime.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +19 -5
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/json.d.ts.map +1 -1
- package/dist/src/func/builtins/json.js +23 -17
- package/dist/src/func/builtins/json.js.map +1 -1
- package/dist/src/func/builtins/mutation.js +2 -2
- package/dist/src/func/builtins/mutation.js.map +1 -1
- package/dist/src/func/builtins/return-types.d.ts +327 -0
- package/dist/src/func/builtins/return-types.d.ts.map +1 -0
- package/dist/src/func/builtins/return-types.js +43 -0
- package/dist/src/func/builtins/return-types.js.map +1 -0
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +150 -79
- package/dist/src/func/builtins/scalar.js.map +1 -1
- package/dist/src/func/builtins/schema.d.ts.map +1 -1
- package/dist/src/func/builtins/schema.js +43 -8
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/func/builtins/string.d.ts.map +1 -1
- package/dist/src/func/builtins/string.js +4 -2
- package/dist/src/func/builtins/string.js.map +1 -1
- package/dist/src/func/builtins/timespan.d.ts +3 -0
- package/dist/src/func/builtins/timespan.d.ts.map +1 -1
- package/dist/src/func/builtins/timespan.js +15 -11
- package/dist/src/func/builtins/timespan.js.map +1 -1
- package/dist/src/func/registration.d.ts +35 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +235 -41
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +14 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/ast.d.ts +58 -1
- package/dist/src/parser/ast.d.ts.map +1 -1
- package/dist/src/parser/parser.d.ts +46 -0
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +161 -45
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/parser/utils.d.ts +13 -1
- package/dist/src/parser/utils.d.ts.map +1 -1
- package/dist/src/parser/utils.js +14 -0
- package/dist/src/parser/utils.js.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.js +7 -2
- package/dist/src/planner/analysis/assertion-classifier.js.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.js +5 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js.map +1 -1
- package/dist/src/planner/analysis/change-scope.d.ts +11 -3
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
- package/dist/src/planner/analysis/change-scope.js +5 -4
- package/dist/src/planner/analysis/change-scope.js.map +1 -1
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
- package/dist/src/planner/analysis/check-extraction.js +37 -4
- package/dist/src/planner/analysis/check-extraction.js.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.d.ts +20 -22
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.js +29 -26
- package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.d.ts +0 -7
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +59 -59
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +13 -5
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/equi-correlation.d.ts +6 -1
- package/dist/src/planner/analysis/equi-correlation.d.ts.map +1 -1
- package/dist/src/planner/analysis/equi-correlation.js +8 -1
- package/dist/src/planner/analysis/equi-correlation.js.map +1 -1
- package/dist/src/planner/analysis/predicate-dependencies.d.ts +34 -0
- package/dist/src/planner/analysis/predicate-dependencies.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-dependencies.js +60 -0
- package/dist/src/planner/analysis/predicate-dependencies.js.map +1 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.js +0 -26
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +117 -43
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/coercion.d.ts +21 -45
- package/dist/src/planner/building/coercion.d.ts.map +1 -1
- package/dist/src/planner/building/coercion.js +42 -91
- package/dist/src/planner/building/coercion.js.map +1 -1
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +9 -5
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/create-assertion.d.ts.map +1 -1
- package/dist/src/planner/building/create-assertion.js +72 -1
- package/dist/src/planner/building/create-assertion.js.map +1 -1
- package/dist/src/planner/building/create-view.d.ts +6 -1
- package/dist/src/planner/building/create-view.d.ts.map +1 -1
- package/dist/src/planner/building/create-view.js +12 -3
- package/dist/src/planner/building/create-view.js.map +1 -1
- package/dist/src/planner/building/ddl.d.ts.map +1 -1
- package/dist/src/planner/building/ddl.js +6 -2
- package/dist/src/planner/building/ddl.js.map +1 -1
- package/dist/src/planner/building/delete.d.ts.map +1 -1
- package/dist/src/planner/building/delete.js +23 -10
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/dml-target.d.ts.map +1 -1
- package/dist/src/planner/building/dml-target.js +4 -0
- package/dist/src/planner/building/dml-target.js.map +1 -1
- package/dist/src/planner/building/drop-assertion.d.ts.map +1 -1
- package/dist/src/planner/building/drop-assertion.js +3 -1
- package/dist/src/planner/building/drop-assertion.js.map +1 -1
- package/dist/src/planner/building/expression.d.ts +17 -0
- package/dist/src/planner/building/expression.d.ts.map +1 -1
- package/dist/src/planner/building/expression.js +28 -17
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +7 -5
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/function-call.d.ts +35 -0
- package/dist/src/planner/building/function-call.d.ts.map +1 -1
- package/dist/src/planner/building/function-call.js +60 -42
- package/dist/src/planner/building/function-call.js.map +1 -1
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +185 -48
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/materialized-view.d.ts.map +1 -1
- package/dist/src/planner/building/materialized-view.js +3 -1
- package/dist/src/planner/building/materialized-view.js.map +1 -1
- package/dist/src/planner/building/schema-authored-context.d.ts +69 -0
- package/dist/src/planner/building/schema-authored-context.d.ts.map +1 -0
- package/dist/src/planner/building/schema-authored-context.js +75 -0
- package/dist/src/planner/building/schema-authored-context.js.map +1 -0
- package/dist/src/planner/building/schema-resolution.d.ts.map +1 -1
- package/dist/src/planner/building/schema-resolution.js +7 -4
- package/dist/src/planner/building/schema-resolution.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +188 -3
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +449 -65
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-compound.js +2 -2
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/select-context.d.ts +98 -0
- package/dist/src/planner/building/select-context.d.ts.map +1 -1
- package/dist/src/planner/building/select-context.js +120 -37
- package/dist/src/planner/building/select-context.js.map +1 -1
- package/dist/src/planner/building/select-modifiers.d.ts +10 -3
- package/dist/src/planner/building/select-modifiers.d.ts.map +1 -1
- package/dist/src/planner/building/select-modifiers.js +29 -8
- package/dist/src/planner/building/select-modifiers.js.map +1 -1
- package/dist/src/planner/building/select-ordinal.d.ts +64 -19
- package/dist/src/planner/building/select-ordinal.d.ts.map +1 -1
- package/dist/src/planner/building/select-ordinal.js +79 -30
- package/dist/src/planner/building/select-ordinal.js.map +1 -1
- package/dist/src/planner/building/select-projections.d.ts +1 -1
- package/dist/src/planner/building/select-projections.d.ts.map +1 -1
- package/dist/src/planner/building/select-projections.js +18 -11
- package/dist/src/planner/building/select-projections.js.map +1 -1
- package/dist/src/planner/building/select-window.d.ts +13 -3
- package/dist/src/planner/building/select-window.d.ts.map +1 -1
- package/dist/src/planner/building/select-window.js +142 -37
- package/dist/src/planner/building/select-window.js.map +1 -1
- package/dist/src/planner/building/select.d.ts +37 -1
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +240 -109
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +27 -13
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.js +102 -8
- package/dist/src/planner/building/view-mutation-builder.js.map +1 -1
- package/dist/src/planner/building/with.d.ts.map +1 -1
- package/dist/src/planner/building/with.js +34 -4
- package/dist/src/planner/building/with.js.map +1 -1
- package/dist/src/planner/cache/correlation-detector.d.ts +15 -0
- package/dist/src/planner/cache/correlation-detector.d.ts.map +1 -1
- package/dist/src/planner/cache/correlation-detector.js +26 -0
- package/dist/src/planner/cache/correlation-detector.js.map +1 -1
- package/dist/src/planner/cache/materialization-advisory.d.ts +7 -0
- package/dist/src/planner/cache/materialization-advisory.d.ts.map +1 -1
- package/dist/src/planner/cache/materialization-advisory.js +12 -3
- package/dist/src/planner/cache/materialization-advisory.js.map +1 -1
- package/dist/src/planner/cost/conjunct-cost.d.ts +40 -0
- package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -1
- package/dist/src/planner/cost/conjunct-cost.js +45 -0
- package/dist/src/planner/cost/conjunct-cost.js.map +1 -1
- package/dist/src/planner/cost/index.d.ts +10 -0
- package/dist/src/planner/cost/index.d.ts.map +1 -1
- package/dist/src/planner/cost/index.js +15 -0
- package/dist/src/planner/cost/index.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +9 -0
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js.map +1 -1
- package/dist/src/planner/framework/pass.d.ts +2 -0
- package/dist/src/planner/framework/pass.d.ts.map +1 -1
- package/dist/src/planner/framework/pass.js +15 -0
- package/dist/src/planner/framework/pass.js.map +1 -1
- package/dist/src/planner/mutation/backward-body.d.ts.map +1 -1
- package/dist/src/planner/mutation/backward-body.js +4 -1
- package/dist/src/planner/mutation/backward-body.js.map +1 -1
- package/dist/src/planner/mutation/body-context.d.ts +23 -0
- package/dist/src/planner/mutation/body-context.d.ts.map +1 -0
- package/dist/src/planner/mutation/body-context.js +26 -0
- package/dist/src/planner/mutation/body-context.js.map +1 -0
- package/dist/src/planner/mutation/cte-flatten.js +15 -2
- package/dist/src/planner/mutation/cte-flatten.js.map +1 -1
- package/dist/src/planner/mutation/decomposition.d.ts +8 -0
- package/dist/src/planner/mutation/decomposition.d.ts.map +1 -1
- package/dist/src/planner/mutation/decomposition.js +8 -3
- package/dist/src/planner/mutation/decomposition.js.map +1 -1
- package/dist/src/planner/mutation/lens-enforcement.js +1 -1
- package/dist/src/planner/mutation/multi-source.d.ts +7 -0
- package/dist/src/planner/mutation/multi-source.d.ts.map +1 -1
- package/dist/src/planner/mutation/multi-source.js +5 -0
- package/dist/src/planner/mutation/multi-source.js.map +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts.map +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.js.map +1 -1
- package/dist/src/planner/mutation/scope-transform.d.ts +32 -0
- package/dist/src/planner/mutation/scope-transform.d.ts.map +1 -1
- package/dist/src/planner/mutation/scope-transform.js +181 -33
- package/dist/src/planner/mutation/scope-transform.js.map +1 -1
- package/dist/src/planner/mutation/set-op.d.ts.map +1 -1
- package/dist/src/planner/mutation/set-op.js +66 -16
- package/dist/src/planner/mutation/set-op.js.map +1 -1
- package/dist/src/planner/mutation/single-source.d.ts.map +1 -1
- package/dist/src/planner/mutation/single-source.js +100 -24
- package/dist/src/planner/mutation/single-source.js.map +1 -1
- package/dist/src/planner/nodes/add-constraint-node.d.ts +15 -1
- package/dist/src/planner/nodes/add-constraint-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/add-constraint-node.js +10 -1
- package/dist/src/planner/nodes/add-constraint-node.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +15 -0
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +32 -17
- package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
- package/dist/src/planner/nodes/alias-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alias-node.js +2 -1
- package/dist/src/planner/nodes/alias-node.js.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.d.ts +51 -10
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.js +49 -2
- package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
- package/dist/src/planner/nodes/asof-scan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/asof-scan-node.js +4 -1
- package/dist/src/planner/nodes/asof-scan-node.js.map +1 -1
- package/dist/src/planner/nodes/asserted-keys-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/asserted-keys-node.js +2 -1
- package/dist/src/planner/nodes/asserted-keys-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +8 -3
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/cache-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/cache-node.js +2 -1
- package/dist/src/planner/nodes/cache-node.js.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.js +17 -19
- package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
- package/dist/src/planner/nodes/create-assertion-node.d.ts +2 -1
- package/dist/src/planner/nodes/create-assertion-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/create-assertion-node.js +5 -2
- package/dist/src/planner/nodes/create-assertion-node.js.map +1 -1
- package/dist/src/planner/nodes/cte-node.d.ts +19 -9
- package/dist/src/planner/nodes/cte-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/cte-node.js +25 -9
- package/dist/src/planner/nodes/cte-node.js.map +1 -1
- package/dist/src/planner/nodes/delete-node.d.ts +20 -2
- package/dist/src/planner/nodes/delete-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/delete-node.js +11 -2
- package/dist/src/planner/nodes/delete-node.js.map +1 -1
- package/dist/src/planner/nodes/distinct-node.d.ts +6 -0
- package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/distinct-node.js +10 -2
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts +58 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.js +107 -15
- package/dist/src/planner/nodes/dml-executor-node.js.map +1 -1
- package/dist/src/planner/nodes/drop-assertion-node.d.ts +2 -1
- package/dist/src/planner/nodes/drop-assertion-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/drop-assertion-node.js +5 -2
- package/dist/src/planner/nodes/drop-assertion-node.js.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.js +2 -1
- package/dist/src/planner/nodes/eager-prefetch-node.js.map +1 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts +5 -0
- package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.js +13 -6
- package/dist/src/planner/nodes/fanout-lookup-join-node.js.map +1 -1
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +18 -5
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +1 -0
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +21 -16
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/insert-node.d.ts +19 -2
- package/dist/src/planner/nodes/insert-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/insert-node.js +10 -2
- package/dist/src/planner/nodes/insert-node.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts +20 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +30 -9
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +21 -0
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +26 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +42 -10
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.js +90 -17
- package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts +5 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js +2 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js.map +1 -1
- package/dist/src/planner/nodes/limit-offset.d.ts +6 -0
- package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
- package/dist/src/planner/nodes/limit-offset.js +10 -2
- package/dist/src/planner/nodes/limit-offset.js.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +8 -3
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts +5 -0
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.js +9 -2
- package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +29 -0
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node.js +12 -0
- package/dist/src/planner/nodes/plan-node.js.map +1 -1
- package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/project-node.js +18 -36
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +3 -2
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts +16 -2
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +10 -2
- package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
- package/dist/src/planner/nodes/returning-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/returning-node.js +13 -32
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +5 -18
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/sort.d.ts.map +1 -1
- package/dist/src/planner/nodes/sort.js +3 -1
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts +1 -0
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +22 -20
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +89 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +69 -2
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/update-node.d.ts +19 -2
- package/dist/src/planner/nodes/update-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/update-node.js +10 -2
- package/dist/src/planner/nodes/update-node.js.map +1 -1
- package/dist/src/planner/nodes/window-function.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-function.js +8 -0
- package/dist/src/planner/nodes/window-function.js.map +1 -1
- package/dist/src/planner/nodes/window-node.d.ts +1 -1
- package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-node.js +3 -1
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts +27 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +130 -10
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/planning-context.d.ts +24 -0
- package/dist/src/planner/planning-context.d.ts.map +1 -1
- package/dist/src/planner/planning-context.js.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +78 -20
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.js +296 -135
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts +30 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js +70 -5
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts +7 -4
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +39 -5
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.js +15 -2
- package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js +10 -3
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js +6 -4
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +5 -31
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js +4 -44
- package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
- package/dist/src/planner/rules/join/index-nested-loop.d.ts +49 -0
- package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -0
- package/dist/src/planner/rules/join/index-nested-loop.js +291 -0
- package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -0
- package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +8 -8
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.d.ts +4 -0
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js +50 -15
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts +6 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.js +25 -9
- package/dist/src/planner/rules/join/rule-join-elimination.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.d.ts +7 -0
- package/dist/src/planner/rules/join/rule-join-key-inference.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.js +23 -11
- package/dist/src/planner/rules/join/rule-join-key-inference.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts +10 -4
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.js +115 -29
- package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts +2 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +18 -4
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts +2 -2
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js +19 -22
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +21 -8
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +70 -14
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +56 -17
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +103 -154
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts +76 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js +208 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts +14 -11
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +21 -85
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts +7 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +18 -22
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/shared/access-leaf.d.ts +52 -0
- package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -0
- package/dist/src/planner/rules/shared/access-leaf.js +95 -0
- package/dist/src/planner/rules/shared/access-leaf.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +17 -7
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts +3 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +26 -9
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +69 -11
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts +17 -7
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.js +124 -87
- package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -1
- package/dist/src/planner/scopes/aliased.d.ts.map +1 -1
- package/dist/src/planner/scopes/aliased.js +6 -0
- package/dist/src/planner/scopes/aliased.js.map +1 -1
- package/dist/src/planner/stats/catalog-stats.d.ts +44 -13
- package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
- package/dist/src/planner/stats/catalog-stats.js +137 -61
- package/dist/src/planner/stats/catalog-stats.js.map +1 -1
- package/dist/src/planner/stats/conjunct-selectivity.d.ts +48 -0
- package/dist/src/planner/stats/conjunct-selectivity.d.ts.map +1 -0
- package/dist/src/planner/stats/conjunct-selectivity.js +168 -0
- package/dist/src/planner/stats/conjunct-selectivity.js.map +1 -0
- package/dist/src/planner/stats/index.d.ts +22 -3
- package/dist/src/planner/stats/index.d.ts.map +1 -1
- package/dist/src/planner/stats/index.js.map +1 -1
- package/dist/src/planner/stats/table-cardinality.d.ts +28 -0
- package/dist/src/planner/stats/table-cardinality.d.ts.map +1 -0
- package/dist/src/planner/stats/table-cardinality.js +29 -0
- package/dist/src/planner/stats/table-cardinality.js.map +1 -0
- package/dist/src/planner/stored-body-context.d.ts +57 -0
- package/dist/src/planner/stored-body-context.d.ts.map +1 -0
- package/dist/src/planner/stored-body-context.js +64 -0
- package/dist/src/planner/stored-body-context.js.map +1 -0
- package/dist/src/planner/util/column-origins.d.ts +29 -8
- package/dist/src/planner/util/column-origins.d.ts.map +1 -1
- package/dist/src/planner/util/column-origins.js +74 -14
- package/dist/src/planner/util/column-origins.js.map +1 -1
- package/dist/src/planner/util/fd-utils.d.ts +32 -8
- package/dist/src/planner/util/fd-utils.d.ts.map +1 -1
- package/dist/src/planner/util/fd-utils.js +46 -9
- package/dist/src/planner/util/fd-utils.js.map +1 -1
- package/dist/src/planner/util/ind-utils.d.ts +66 -19
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +91 -21
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts +36 -3
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +57 -7
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/planner/util/output-names.d.ts +12 -0
- package/dist/src/planner/util/output-names.d.ts.map +1 -0
- package/dist/src/planner/util/output-names.js +20 -0
- package/dist/src/planner/util/output-names.js.map +1 -0
- package/dist/src/planner/util/row-estimates.d.ts +39 -0
- package/dist/src/planner/util/row-estimates.d.ts.map +1 -0
- package/dist/src/planner/util/row-estimates.js +68 -0
- package/dist/src/planner/util/row-estimates.js.map +1 -0
- package/dist/src/planner/util/row-population.d.ts +42 -0
- package/dist/src/planner/util/row-population.d.ts.map +1 -0
- package/dist/src/planner/util/row-population.js +71 -0
- package/dist/src/planner/util/row-population.js.map +1 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.js +3 -2
- package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
- package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
- package/dist/src/runtime/emit/add-constraint.js +60 -6
- package/dist/src/runtime/emit/add-constraint.js.map +1 -1
- package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/aggregate.js +4 -4
- package/dist/src/runtime/emit/aggregate.js.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.d.ts +97 -0
- package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -0
- package/dist/src/runtime/emit/alter-schema-event.js +87 -0
- package/dist/src/runtime/emit/alter-schema-event.js.map +1 -0
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +582 -236
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
- package/dist/src/runtime/emit/analyze.js +50 -7
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/assertion-drop-guard.d.ts +37 -0
- package/dist/src/runtime/emit/assertion-drop-guard.d.ts.map +1 -0
- package/dist/src/runtime/emit/assertion-drop-guard.js +59 -0
- package/dist/src/runtime/emit/assertion-drop-guard.js.map +1 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.d.ts +33 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.d.ts.map +1 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.js +124 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.js.map +1 -0
- package/dist/src/runtime/emit/cast.d.ts.map +1 -1
- package/dist/src/runtime/emit/cast.js +4 -19
- package/dist/src/runtime/emit/cast.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +10 -227
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/create-assertion.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-assertion.js +31 -14
- package/dist/src/runtime/emit/create-assertion.js.map +1 -1
- package/dist/src/runtime/emit/cte.d.ts.map +1 -1
- package/dist/src/runtime/emit/cte.js +11 -6
- package/dist/src/runtime/emit/cte.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +233 -28
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.js +8 -8
- package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
- package/dist/src/runtime/emit/drop-column-guards.d.ts +151 -0
- package/dist/src/runtime/emit/drop-column-guards.d.ts.map +1 -0
- package/dist/src/runtime/emit/drop-column-guards.js +230 -0
- package/dist/src/runtime/emit/drop-column-guards.js.map +1 -0
- package/dist/src/runtime/emit/drop-index.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-index.js +4 -3
- package/dist/src/runtime/emit/drop-index.js.map +1 -1
- package/dist/src/runtime/emit/drop-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-table.js +6 -0
- package/dist/src/runtime/emit/drop-table.js.map +1 -1
- package/dist/src/runtime/emit/drop-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-view.js +4 -0
- package/dist/src/runtime/emit/drop-view.js.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.js +2 -2
- package/dist/src/runtime/emit/hash-aggregate.js.map +1 -1
- package/dist/src/runtime/emit/join.d.ts.map +1 -1
- package/dist/src/runtime/emit/join.js +8 -67
- package/dist/src/runtime/emit/join.js.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.js +11 -3
- package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts +4 -4
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view-helpers.js +34 -22
- package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view.js +7 -2
- package/dist/src/runtime/emit/materialized-view.js.map +1 -1
- package/dist/src/runtime/emit/operand-comparator.d.ts +30 -0
- package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -1
- package/dist/src/runtime/emit/operand-comparator.js +34 -0
- package/dist/src/runtime/emit/operand-comparator.js.map +1 -1
- package/dist/src/runtime/emit/recursive-cte.d.ts.map +1 -1
- package/dist/src/runtime/emit/recursive-cte.js +4 -5
- package/dist/src/runtime/emit/recursive-cte.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +30 -0
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
- package/dist/src/runtime/emit/subquery.js +153 -52
- package/dist/src/runtime/emit/subquery.js.map +1 -1
- package/dist/src/runtime/emit/update.d.ts.map +1 -1
- package/dist/src/runtime/emit/update.js +18 -6
- package/dist/src/runtime/emit/update.js.map +1 -1
- package/dist/src/runtime/emit/window.js +36 -23
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/row-constraints.d.ts +85 -0
- package/dist/src/runtime/row-constraints.d.ts.map +1 -0
- package/dist/src/runtime/row-constraints.js +239 -0
- package/dist/src/runtime/row-constraints.js.map +1 -0
- package/dist/src/runtime/types.d.ts +8 -11
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.js.map +1 -1
- package/dist/src/schema/assertion.d.ts +14 -1
- package/dist/src/schema/assertion.d.ts.map +1 -1
- package/dist/src/schema/assertion.js +14 -1
- package/dist/src/schema/assertion.js.map +1 -1
- package/dist/src/schema/catalog-persistability.d.ts +19 -16
- package/dist/src/schema/catalog-persistability.d.ts.map +1 -1
- package/dist/src/schema/catalog-persistability.js +92 -20
- package/dist/src/schema/catalog-persistability.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +73 -2
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +220 -39
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/column-source-resolver.d.ts +18 -0
- package/dist/src/schema/column-source-resolver.d.ts.map +1 -0
- package/dist/src/schema/column-source-resolver.js +22 -0
- package/dist/src/schema/column-source-resolver.js.map +1 -0
- package/dist/src/schema/column.d.ts +26 -3
- package/dist/src/schema/column.d.ts.map +1 -1
- package/dist/src/schema/column.js.map +1 -1
- package/dist/src/schema/constraint-builder.d.ts.map +1 -1
- package/dist/src/schema/constraint-builder.js +7 -1
- package/dist/src/schema/constraint-builder.js.map +1 -1
- package/dist/src/schema/ddl-generator.d.ts.map +1 -1
- package/dist/src/schema/ddl-generator.js +27 -6
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/function.d.ts +32 -1
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js +10 -2
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/lens-compiler.d.ts.map +1 -1
- package/dist/src/schema/lens-compiler.js +203 -51
- package/dist/src/schema/lens-compiler.js.map +1 -1
- package/dist/src/schema/lens-prover.d.ts +2 -3
- package/dist/src/schema/lens-prover.d.ts.map +1 -1
- package/dist/src/schema/lens-prover.js +19 -11
- package/dist/src/schema/lens-prover.js.map +1 -1
- package/dist/src/schema/manager.d.ts +115 -20
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +202 -70
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts +142 -0
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +254 -9
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/reserved-tags.d.ts +1 -1
- package/dist/src/schema/reserved-tags.d.ts.map +1 -1
- package/dist/src/schema/reserved-tags.js +4 -3
- package/dist/src/schema/reserved-tags.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts +16 -0
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +225 -38
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/table.d.ts +149 -1
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +248 -1
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/schema/unique-enforcement.d.ts +5 -3
- package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
- package/dist/src/schema/unique-enforcement.js +5 -3
- package/dist/src/schema/unique-enforcement.js.map +1 -1
- package/dist/src/schema/view.d.ts +11 -0
- package/dist/src/schema/view.d.ts.map +1 -1
- package/dist/src/schema/view.js +12 -0
- package/dist/src/schema/view.js.map +1 -1
- package/dist/src/types/builtin-types.d.ts +54 -0
- package/dist/src/types/builtin-types.d.ts.map +1 -1
- package/dist/src/types/builtin-types.js +123 -34
- package/dist/src/types/builtin-types.js.map +1 -1
- package/dist/src/types/cast-semantics.d.ts +42 -0
- package/dist/src/types/cast-semantics.d.ts.map +1 -1
- package/dist/src/types/cast-semantics.js +64 -0
- package/dist/src/types/cast-semantics.js.map +1 -1
- package/dist/src/types/comparison-coercion.d.ts +101 -0
- package/dist/src/types/comparison-coercion.d.ts.map +1 -0
- package/dist/src/types/comparison-coercion.js +162 -0
- package/dist/src/types/comparison-coercion.js.map +1 -0
- package/dist/src/types/index.d.ts +2 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +2 -2
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/logical-type.d.ts +7 -0
- package/dist/src/types/logical-type.d.ts.map +1 -1
- package/dist/src/types/logical-type.js.map +1 -1
- package/dist/src/types/validation.d.ts +56 -0
- package/dist/src/types/validation.d.ts.map +1 -1
- package/dist/src/types/validation.js +68 -0
- package/dist/src/types/validation.js.map +1 -1
- package/dist/src/util/{working-table-iterable.d.ts → array-row-iterable.d.ts} +6 -6
- package/dist/src/util/array-row-iterable.d.ts.map +1 -0
- package/dist/src/util/{working-table-iterable.js → array-row-iterable.js} +6 -6
- package/dist/src/util/array-row-iterable.js.map +1 -0
- package/dist/src/util/coercion.d.ts +8 -0
- package/dist/src/util/coercion.d.ts.map +1 -1
- package/dist/src/util/coercion.js +8 -0
- package/dist/src/util/coercion.js.map +1 -1
- package/dist/src/util/comparison.d.ts +16 -3
- package/dist/src/util/comparison.d.ts.map +1 -1
- package/dist/src/util/comparison.js +21 -5
- package/dist/src/util/comparison.js.map +1 -1
- package/dist/src/util/key-serializer.d.ts +46 -0
- package/dist/src/util/key-serializer.d.ts.map +1 -1
- package/dist/src/util/key-serializer.js +47 -0
- package/dist/src/util/key-serializer.js.map +1 -1
- package/dist/src/util/value-set.d.ts +21 -0
- package/dist/src/util/value-set.d.ts.map +1 -0
- package/dist/src/util/value-set.js +22 -0
- package/dist/src/util/value-set.js.map +1 -0
- package/dist/src/vtab/capabilities.d.ts +1 -1
- package/dist/src/vtab/events.d.ts +8 -1
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js.map +1 -1
- package/dist/src/vtab/manifest.d.ts +15 -0
- package/dist/src/vtab/manifest.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/alter-column.d.ts +147 -0
- package/dist/src/vtab/memory/layer/alter-column.d.ts.map +1 -0
- package/dist/src/vtab/memory/layer/alter-column.js +214 -0
- package/dist/src/vtab/memory/layer/alter-column.js.map +1 -0
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +4 -3
- package/dist/src/vtab/memory/layer/base.js.map +1 -1
- package/dist/src/vtab/memory/layer/interface.d.ts +2 -2
- package/dist/src/vtab/memory/layer/interface.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +176 -25
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +569 -558
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.js +32 -5
- package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.d.ts +101 -15
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +133 -45
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +16 -1
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +64 -3
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/table.d.ts.map +1 -1
- package/dist/src/vtab/memory/table.js +11 -6
- package/dist/src/vtab/memory/table.js.map +1 -1
- package/dist/src/vtab/module.d.ts +77 -23
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +9 -2
- package/dist/src/vtab/table.d.ts.map +1 -1
- package/dist/src/vtab/table.js +1 -1
- package/dist/src/vtab/table.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/util/working-table-iterable.d.ts.map +0 -1
- package/dist/src/util/working-table-iterable.js.map +0 -1
|
@@ -6,17 +6,43 @@ import { StatusCode } from '../../common/types.js';
|
|
|
6
6
|
import { PlanNode } from '../nodes/plan-node.js';
|
|
7
7
|
import { buildExpression } from './expression.js';
|
|
8
8
|
import { buildRowDefaultScope } from './default-scope.js';
|
|
9
|
-
import { validateDeterministicDefault } from '../validation/determinism-validator.js';
|
|
9
|
+
import { validateDeterministicDefault, validateDeterministicGenerated } from '../validation/determinism-validator.js';
|
|
10
10
|
import { tryFoldLiteral } from '../../parser/utils.js';
|
|
11
11
|
import { inferType } from '../../types/registry.js';
|
|
12
12
|
import { columnSchemaToScalarType } from '../type-utils.js';
|
|
13
|
-
import { expressionToString } from '../../emit/ast-stringify.js';
|
|
13
|
+
import { astToString, expressionToString } from '../../emit/ast-stringify.js';
|
|
14
14
|
import { validateReservedTags } from '../../schema/reserved-tags.js';
|
|
15
|
+
import { validateAddColumnGeneratedRefs } from '../../schema/table.js';
|
|
15
16
|
import { columnTagDiagnostics, raiseStmtTagDiagnostics } from './tag-diagnostics.js';
|
|
16
17
|
import { planViewBody } from './create-view.js';
|
|
18
|
+
import { schemaAuthoredContext } from './schema-authored-context.js';
|
|
17
19
|
export function buildAlterTableStmt(ctx, stmt) {
|
|
18
20
|
const tableRetrieve = buildTableReference({ type: 'table', table: stmt.table }, ctx);
|
|
19
21
|
const tableReference = tableRetrieve.tableRef; // Extract the actual TableReferenceNode
|
|
22
|
+
// Canonical, fully-qualified SQL for the whole statement, rendered ONCE here — the one
|
|
23
|
+
// place that holds the parsed action and the resolved table together. Rendered from a
|
|
24
|
+
// SYNTHETIC statement whose table identifier is rebuilt from the resolved TableSchema,
|
|
25
|
+
// not from `stmt.table` as the user wrote it: an unqualified `alter table orders …`
|
|
26
|
+
// must not become a statement a receiver resolves against a different default schema.
|
|
27
|
+
// Same qualification rule as `generateTableDDL` / the schema differ's synthetic ALTER
|
|
28
|
+
// (schema-differ.ts), so the two wire sources agree. The runtime arms thread it to the
|
|
29
|
+
// module (`SchemaChangeInfo.ddl` / `renameTable`'s `ddl`) and onto the public
|
|
30
|
+
// schema-change event.
|
|
31
|
+
//
|
|
32
|
+
// NOTE: rendered for EVERY arm, including the four that never announce anything (the tag
|
|
33
|
+
// arms, `set`/`drop maintained`) — `set maintained as <select>` therefore stringifies its
|
|
34
|
+
// whole SELECT body for a string nobody reads. Free today: ALTER is not a hot path and
|
|
35
|
+
// each statement builds once. If those arms ever start carrying a rendering cost that
|
|
36
|
+
// matters, render lazily and hand the arms a thunk instead of a string.
|
|
37
|
+
const { schemaName, name: tableName } = tableReference.tableSchema;
|
|
38
|
+
const canonicalStmt = {
|
|
39
|
+
type: 'alterTable',
|
|
40
|
+
table: schemaName.toLowerCase() === 'main'
|
|
41
|
+
? { type: 'identifier', name: tableName }
|
|
42
|
+
: { type: 'identifier', name: tableName, schema: schemaName },
|
|
43
|
+
action: stmt.action,
|
|
44
|
+
};
|
|
45
|
+
const sql = astToString(canonicalStmt);
|
|
20
46
|
switch (stmt.action.type) {
|
|
21
47
|
case 'addConstraint': {
|
|
22
48
|
// Reject a typo'd / mis-sited reserved `quereus.*` tag on the constraint at
|
|
@@ -29,19 +55,19 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
29
55
|
...stmt.action.constraint,
|
|
30
56
|
operations
|
|
31
57
|
};
|
|
32
|
-
return new AddConstraintNode(ctx.scope, tableReference, constraintWithBitmask);
|
|
58
|
+
return new AddConstraintNode(ctx.scope, tableReference, constraintWithBitmask, sql);
|
|
33
59
|
}
|
|
34
60
|
case 'renameTable':
|
|
35
61
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
36
62
|
type: 'renameTable',
|
|
37
63
|
newName: stmt.action.newName,
|
|
38
|
-
});
|
|
64
|
+
}, sql);
|
|
39
65
|
case 'renameColumn':
|
|
40
66
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
41
67
|
type: 'renameColumn',
|
|
42
68
|
oldName: stmt.action.oldName,
|
|
43
69
|
newName: stmt.action.newName,
|
|
44
|
-
});
|
|
70
|
+
}, sql);
|
|
45
71
|
case 'addColumn': {
|
|
46
72
|
const column = stmt.action.column;
|
|
47
73
|
// Reject a typo'd / mis-sited reserved `quereus.*` tag on the new column or any
|
|
@@ -53,7 +79,10 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
53
79
|
// columns / non-determinism rejected; `new.<column>` accepted with its build
|
|
54
80
|
// deferred). This runs before building the backfill so a bare-column default
|
|
55
81
|
// is rejected here rather than silently resolving against the existing columns
|
|
56
|
-
// the backfill scope exposes.
|
|
82
|
+
// the backfill scope exposes. DEFAULT only: a GENERATED ALWAYS AS expression is
|
|
83
|
+
// written with bare column references by definition, so this validator would
|
|
84
|
+
// reject every legal one. Its determinism is checked inside
|
|
85
|
+
// `buildAddColumnBackfill` instead, with the generated-flavoured validator.
|
|
57
86
|
const defaultConstraint = column.constraints?.find(c => c.type === 'default');
|
|
58
87
|
if (defaultConstraint?.expr) {
|
|
59
88
|
const hasMutationContext = !!tableReference.tableSchema.mutationContext
|
|
@@ -61,41 +90,42 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
61
90
|
ctx.schemaManager.validateAddColumnDefault(defaultConstraint.expr, column.name, tableReference.tableSchema.name, hasMutationContext);
|
|
62
91
|
}
|
|
63
92
|
const backfill = buildAddColumnBackfill(ctx, tableReference, column);
|
|
64
|
-
// For the per-row (evaluator)
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// compiled when a backfill is
|
|
93
|
+
// For the per-row (evaluator) path — a non-foldable DEFAULT or a GENERATED ALWAYS AS
|
|
94
|
+
// expression — enforce any CHECK on the new column against each backfilled row by
|
|
95
|
+
// compiling the predicates here and evaluating them inside the per-row backfill hook
|
|
96
|
+
// (mirrors the NOT NULL per-row path) — a violating row aborts the ALTER before any
|
|
97
|
+
// tree/batch swap. The literal-default path is left to the post-backfill scan
|
|
98
|
+
// (`validateBackfillAgainstChecks`), so checks are only compiled when a backfill is
|
|
99
|
+
// present.
|
|
70
100
|
const checks = backfill ? buildAddColumnChecks(ctx, tableReference, column) : undefined;
|
|
71
101
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
72
102
|
type: 'addColumn',
|
|
73
103
|
column,
|
|
74
104
|
backfill,
|
|
75
105
|
checks,
|
|
76
|
-
});
|
|
106
|
+
}, sql);
|
|
77
107
|
}
|
|
78
108
|
case 'dropColumn':
|
|
79
109
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
80
110
|
type: 'dropColumn',
|
|
81
111
|
name: stmt.action.name,
|
|
82
|
-
});
|
|
112
|
+
}, sql);
|
|
83
113
|
case 'dropConstraint':
|
|
84
114
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
85
115
|
type: 'dropConstraint',
|
|
86
116
|
name: stmt.action.name,
|
|
87
|
-
});
|
|
117
|
+
}, sql);
|
|
88
118
|
case 'renameConstraint':
|
|
89
119
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
90
120
|
type: 'renameConstraint',
|
|
91
121
|
oldName: stmt.action.oldName,
|
|
92
122
|
newName: stmt.action.newName,
|
|
93
|
-
});
|
|
123
|
+
}, sql);
|
|
94
124
|
case 'alterPrimaryKey':
|
|
95
125
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
96
126
|
type: 'alterPrimaryKey',
|
|
97
127
|
columns: stmt.action.columns,
|
|
98
|
-
});
|
|
128
|
+
}, sql);
|
|
99
129
|
case 'alterColumn':
|
|
100
130
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
101
131
|
type: 'alterColumn',
|
|
@@ -104,7 +134,7 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
104
134
|
setDataType: stmt.action.setDataType,
|
|
105
135
|
setDefault: stmt.action.setDefault,
|
|
106
136
|
setCollation: stmt.action.setCollation,
|
|
107
|
-
});
|
|
137
|
+
}, sql);
|
|
108
138
|
case 'setTags': {
|
|
109
139
|
// Validate any reserved `quereus.*` tags at the matching site so a typo
|
|
110
140
|
// (e.g. `quereus.expose_implicit_indx`) fails loudly here rather than being
|
|
@@ -122,7 +152,7 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
122
152
|
target,
|
|
123
153
|
mode: stmt.action.mode,
|
|
124
154
|
tags: stmt.action.tags,
|
|
125
|
-
});
|
|
155
|
+
}, sql);
|
|
126
156
|
}
|
|
127
157
|
case 'dropTags': {
|
|
128
158
|
// DROP TAGS removes tags by key, so there is NO reserved-tag value
|
|
@@ -133,7 +163,7 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
133
163
|
type: 'dropTags',
|
|
134
164
|
target: stmt.action.target,
|
|
135
165
|
keys: stmt.action.keys,
|
|
136
|
-
});
|
|
166
|
+
}, sql);
|
|
137
167
|
}
|
|
138
168
|
case 'setMaintained': {
|
|
139
169
|
// SET MAINTAINED AS <body> — attach / re-attach a derivation. Reuse the
|
|
@@ -146,7 +176,9 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
146
176
|
// reshape-on-attach (attachMaintainedDerivation), so a build-time arity
|
|
147
177
|
// gate would block legitimate reshapes.
|
|
148
178
|
const tableSchema = tableReference.tableSchema;
|
|
149
|
-
|
|
179
|
+
// Home-schema body path: the derivation's unqualified source names must
|
|
180
|
+
// resolve next to the table the derivation attaches to.
|
|
181
|
+
planViewBody(ctx, tableSchema.name, stmt.action.select, tableSchema.schemaName);
|
|
150
182
|
// Mirror the create-form gate: a generated column would silently diverge
|
|
151
183
|
// from its expression once the body supplies every column's value.
|
|
152
184
|
const generated = tableSchema.columns.find(c => c.generated);
|
|
@@ -163,12 +195,12 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
163
195
|
type: 'setMaintained',
|
|
164
196
|
columns: stmt.action.columns,
|
|
165
197
|
select: stmt.action.select,
|
|
166
|
-
});
|
|
198
|
+
}, sql);
|
|
167
199
|
}
|
|
168
200
|
case 'dropMaintained':
|
|
169
201
|
// Maintained-ness is checked in the emitter against the LIVE table (the
|
|
170
202
|
// build-time schema may be a cached statement's snapshot).
|
|
171
|
-
return new AlterTableNode(ctx.scope, tableReference, { type: 'dropMaintained' });
|
|
203
|
+
return new AlterTableNode(ctx.scope, tableReference, { type: 'dropMaintained' }, sql);
|
|
172
204
|
default:
|
|
173
205
|
throw new QuereusError(
|
|
174
206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -176,26 +208,43 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
176
208
|
}
|
|
177
209
|
}
|
|
178
210
|
/**
|
|
179
|
-
* Compile the per-row backfill of an ADD COLUMN
|
|
180
|
-
* literal (e.g. `new.<col>`)
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
211
|
+
* Compile the per-row backfill of an ADD COLUMN that carries a per-row value source:
|
|
212
|
+
* a DEFAULT that does not fold to a literal (e.g. `new.<col>`), or a GENERATED ALWAYS
|
|
213
|
+
* AS expression (whatever its VIRTUAL / STORED spelling — this engine materializes a
|
|
214
|
+
* generated value at write time either way). Mirrors the single-source INSERT
|
|
215
|
+
* row-expansion and the view-write key default: the expression is built against the
|
|
216
|
+
* table's *existing* columns as the "supplied" row, so both `new.<col>` and the bare
|
|
217
|
+
* `<col>` a generated expression uses resolve to the existing row's sibling during
|
|
218
|
+
* backfill. Returns `undefined` when the column carries neither, or for a
|
|
219
|
+
* literal-folding DEFAULT (the module bulk-writes that from the column's
|
|
220
|
+
* `defaultValue`), so the common case allocates nothing.
|
|
185
221
|
*/
|
|
186
222
|
function buildAddColumnBackfill(ctx, tableReference, columnDef) {
|
|
223
|
+
// A column declares a DEFAULT or a GENERATED ALWAYS AS, never both —
|
|
224
|
+
// `columnDefToSchema` rejects the pair — so at most one arm applies.
|
|
225
|
+
const generatedExpr = columnDef.constraints?.find(c => c.type === 'generated')?.generated?.expr;
|
|
187
226
|
const defaultExpr = columnDef.constraints?.find(c => c.type === 'default')?.expr;
|
|
188
|
-
|
|
227
|
+
const sourceExpr = generatedExpr ?? defaultExpr;
|
|
228
|
+
if (!sourceExpr)
|
|
189
229
|
return undefined;
|
|
190
|
-
// Literal / NULL
|
|
191
|
-
|
|
230
|
+
// Literal / NULL DEFAULTs fold and are bulk-written by the module — no per-row node.
|
|
231
|
+
// Deliberately NOT taken on the generated arm: a generated column has no
|
|
232
|
+
// `defaultValue` for the module to bulk-write, so short-circuiting a constant
|
|
233
|
+
// generated expression (`generated always as (2)`) would leave every existing row
|
|
234
|
+
// NULL. The generated arm always builds the per-row node.
|
|
235
|
+
if (!generatedExpr && tryFoldLiteral(sourceExpr) !== undefined)
|
|
192
236
|
return undefined;
|
|
193
237
|
const tableSchema = tableReference.tableSchema;
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
238
|
+
// Report a bad generated expression the way CREATE TABLE reports it, before the
|
|
239
|
+
// compile below turns an unresolvable (or self-referencing) name into a generic
|
|
240
|
+
// "Column not found".
|
|
241
|
+
if (generatedExpr) {
|
|
242
|
+
validateAddColumnGeneratedRefs(generatedExpr, columnDef.name, tableSchema.columns, tableSchema.name);
|
|
243
|
+
}
|
|
244
|
+
// Fresh attributes for the existing columns, referenced only by this expression's
|
|
245
|
+
// column refs and resolved at runtime via the row slot the emitter installs over
|
|
246
|
+
// each existing row. Minting fresh (rather than reusing the table reference's
|
|
247
|
+
// attributes) keeps the node self-contained so the optimizer can't dangle it.
|
|
199
248
|
const rowAttrs = tableSchema.columns.map(column => ({
|
|
200
249
|
id: PlanNode.nextAttrId(),
|
|
201
250
|
name: column.name,
|
|
@@ -203,17 +252,38 @@ function buildAddColumnBackfill(ctx, tableReference, columnDef) {
|
|
|
203
252
|
sourceRelation: 'add-column-backfill',
|
|
204
253
|
}));
|
|
205
254
|
const rowScope = buildRowDefaultScope(ctx.scope, tableSchema.columns, rowAttrs);
|
|
206
|
-
|
|
255
|
+
// Schema-authored SQL, wrapped exactly as the three DML builders wrap theirs, so the
|
|
256
|
+
// backfill expression resolves bare relation names against the altered table's own
|
|
257
|
+
// schema — not whatever path the ALTER runs on. The CTE half of the wrapper is inert
|
|
258
|
+
// here (ALTER is not an `AST.QueryExpr`, so it can neither be a CTE body nor carry a
|
|
259
|
+
// `with` clause of its own); the schema-path half is the load-bearing part.
|
|
260
|
+
const node = buildExpression({ ...schemaAuthoredContext(ctx, tableSchema.schemaName), scope: rowScope }, sourceExpr);
|
|
261
|
+
// Same validator each arm's write-path build site uses, so an ALTER accepts exactly
|
|
262
|
+
// what the equivalent CREATE TABLE + INSERT accepts. Both honour
|
|
263
|
+
// `nondeterministic_schema`, so the escape hatch is unchanged.
|
|
207
264
|
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
208
|
-
|
|
265
|
+
if (generatedExpr) {
|
|
266
|
+
validateDeterministicGenerated(node, columnDef.name, tableSchema.name);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
validateDeterministicDefault(node, columnDef.name, tableSchema.name);
|
|
270
|
+
}
|
|
209
271
|
}
|
|
210
272
|
const rowDescriptor = [];
|
|
211
273
|
rowAttrs.forEach((attr, index) => { rowDescriptor[attr.id] = index; });
|
|
212
|
-
|
|
274
|
+
// The evaluated value has to reach storage in the new column's declared form, exactly as an
|
|
275
|
+
// INSERT's would. Skip the conversion when the expression's static type already IS that type
|
|
276
|
+
// (identity comparison — the registry hands out one shared LogicalType instance per type),
|
|
277
|
+
// mirroring `buildRowCoercion`: re-converting an already-converted value is destructive for
|
|
278
|
+
// JSON. See `AddColumnBackfill.coerceTo`.
|
|
279
|
+
const newColumnType = inferType(columnDef.dataType);
|
|
280
|
+
const coerceTo = node.getType().logicalType === newColumnType ? undefined : newColumnType;
|
|
281
|
+
return { node, rowDescriptor, coerceTo };
|
|
213
282
|
}
|
|
214
283
|
/**
|
|
215
|
-
* Compile the column-level CHECK predicates of an ADD COLUMN
|
|
216
|
-
*
|
|
284
|
+
* Compile the column-level CHECK predicates of an ADD COLUMN that backfills per row (a
|
|
285
|
+
* non-foldable DEFAULT or a GENERATED ALWAYS AS expression), so they can be enforced per
|
|
286
|
+
* backfilled row inside the backfill hook. Each
|
|
217
287
|
* predicate is built against a row scope covering the table's *existing* columns plus the
|
|
218
288
|
* *new* column, so a CHECK referencing the new column (bare `<col>` or `new.<col>`) and any
|
|
219
289
|
* existing sibling resolves. The new column sits at position `existingColumns.length` in the
|
|
@@ -256,8 +326,12 @@ function buildAddColumnChecks(ctx, tableReference, columnDef) {
|
|
|
256
326
|
const rowAttrs = [...existingAttrs, newColAttr];
|
|
257
327
|
const targetColumns = [...tableSchema.columns, { name: columnDef.name }];
|
|
258
328
|
const rowScope = buildRowDefaultScope(ctx.scope, targetColumns, rowAttrs);
|
|
329
|
+
// Schema-authored, same as the backfill expression above and as every CHECK the DML
|
|
330
|
+
// builders compile: a bare relation name means the ALTERED table's own schema, not
|
|
331
|
+
// whatever path the ALTER runs on.
|
|
332
|
+
const checkCtx = { ...schemaAuthoredContext(ctx, tableSchema.schemaName), scope: rowScope };
|
|
259
333
|
const predicates = checkConstraints.map(con => ({
|
|
260
|
-
node: buildExpression(
|
|
334
|
+
node: buildExpression(checkCtx, con.expr),
|
|
261
335
|
name: con.name,
|
|
262
336
|
exprText: expressionToString(con.expr),
|
|
263
337
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alter-table.js","sourceRoot":"","sources":["../../../../src/planner/building/alter-table.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAA+C,MAAM,8BAA8B,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAA0E,MAAM,uBAAuB,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,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K,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -8,62 +8,33 @@ import type { ScalarPlanNode } from '../nodes/plan-node.js';
|
|
|
8
8
|
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}) —
|
|
9
9
|
* reconciles its operands through this one module so none of them can drift
|
|
10
10
|
* from the others.
|
|
11
|
+
*
|
|
12
|
+
* This file owns only the *rewrite*: which operand gets wrapped in a synthetic
|
|
13
|
+
* `CastNode`. The decision of which operand converts and to what lives in
|
|
14
|
+
* `types/comparison-coercion.ts`, shared with the emit-time consumer
|
|
15
|
+
* (`runtime/emit/operand-comparator.ts` `makeComparisonGroup`) that serves the
|
|
16
|
+
* builtins which return one of their arguments and so cannot be rewritten here.
|
|
11
17
|
*/
|
|
12
18
|
/**
|
|
13
19
|
* Reconcile operands of a comparison whose plan-time types cannot be compared
|
|
14
20
|
* meaningfully as-is, by wrapping one side in a synthetic CastNode.
|
|
15
21
|
* Returns `[left, right]` — possibly with one side replaced by a CastNode.
|
|
16
22
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* 1. **Object-physical vs anything else.** JSON is the engine's only logical type
|
|
20
|
-
* whose `physicalType` is `PhysicalType.OBJECT`: its runtime values are native
|
|
21
|
-
* JS objects/arrays, which `compareSqlValuesFast` short-circuits against any
|
|
22
|
-
* other storage class — so `json_col = '{"a":1}'` was unconditionally false,
|
|
23
|
-
* even for byte-identical text. The non-object side is cast to the object
|
|
24
|
-
* side's type, never the reverse: casting the JSON side to text would make
|
|
25
|
-
* equality depend on spelling and put `=` out of step with the index, which
|
|
26
|
-
* compares structurally.
|
|
27
|
-
*
|
|
28
|
-
* The gate is deliberately `physicalType === OBJECT`, **not**
|
|
29
|
-
* `semanticOrdering`. DATE/TIME/DATETIME/TIMESPAN also carry semantic ordering
|
|
30
|
-
* but are physically text, and the runtime's `tryTemporalComparison` already
|
|
31
|
-
* reconciles them; routing them through a cast would change behavior for no
|
|
32
|
-
* gain.
|
|
33
|
-
*
|
|
34
|
-
* A cast to JSON is lenient (see `runtime/emit/cast.ts`): text that does not
|
|
35
|
-
* parse comes back unchanged, so `json_col = 'not json'` is false rather than
|
|
36
|
-
* an error. Note the consequence for JSON *string scalars*, which are stored
|
|
37
|
-
* as plain JS strings: a column holding `"hello"` matches BOTH the SQL literal
|
|
38
|
-
* `'"hello"'` (parses to the JSON string `hello`) and the bare `'hello'` (does
|
|
39
|
-
* not parse, falls back to the raw string `hello`, which `JSON_TYPE.compare`
|
|
40
|
-
* then compares as text). Only the first form generalizes — `'[1,2]'` matches
|
|
41
|
-
* the JSON array while a bare `[1,2]` is not SQL text at all.
|
|
42
|
-
*
|
|
43
|
-
* 2. **Numeric vs textual.** The textual operand is cast to the numeric side's
|
|
44
|
-
* type name (e.g. 'INTEGER' or 'REAL') so the runtime can take the fast path.
|
|
23
|
+
* See {@link crossTypeCoercion} for the rule (object-physical vs anything else,
|
|
24
|
+
* then numeric vs textual) and why each side is chosen.
|
|
45
25
|
*/
|
|
46
26
|
export declare function insertCrossTypeCoercion(scope: Scope, left: ScalarPlanNode, right: ScalarPlanNode): [ScalarPlanNode, ScalarPlanNode];
|
|
47
27
|
/**
|
|
48
|
-
* Apply
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* never been applied to either site (`int_col in ('1')` is false today for the same
|
|
55
|
-
* underlying reason), and turning it on here would change unrelated behavior; that
|
|
56
|
-
* case is tracked by `bug-numeric-text-coercion-skips-in-and-case`. Note `=` and
|
|
57
|
-
* BETWEEN DO apply it, so those two forms currently disagree with IN / simple CASE
|
|
58
|
-
* on a numeric column compared against a numeric-looking string.
|
|
59
|
-
*
|
|
60
|
-
* The probe is shared by every value, so it is wrapped at most once — if any value
|
|
61
|
-
* is object-physical while the probe is not, the probe is cast first and the values
|
|
62
|
-
* are then reconciled against it.
|
|
28
|
+
* Apply {@link comparisonGroupCoercions} across the one-probe-against-many-values
|
|
29
|
+
* shape shared by an IN value list, a simple CASE and a scalar builtin's
|
|
30
|
+
* comparison group, so `json_col in ('{"a":1}')`, `int_col in ('1')` and
|
|
31
|
+
* `case int_col when '1' …` all agree with the `=` spelling of the same
|
|
32
|
+
* comparison. See that function for the probe-vs-value asymmetry and the one
|
|
33
|
+
* documented gap it leaves.
|
|
63
34
|
*/
|
|
64
|
-
export declare function
|
|
35
|
+
export declare function coerceComparisonSet(scope: Scope, probe: ScalarPlanNode, values: ScalarPlanNode[]): [ScalarPlanNode, ScalarPlanNode[]];
|
|
65
36
|
/**
|
|
66
|
-
* Apply {@link
|
|
37
|
+
* Apply {@link coerceComparisonSet} across the argument positions a scalar
|
|
67
38
|
* function declares as one comparison group
|
|
68
39
|
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}),
|
|
69
40
|
* so `nullif(json_col, '{"a":1}')` reconciles its operands exactly as
|
|
@@ -71,6 +42,11 @@ export declare function coerceObjectPhysicalSet(scope: Scope, probe: ScalarPlanN
|
|
|
71
42
|
* the rest the value-list role; positions outside the argument list are ignored
|
|
72
43
|
* (defensive — a well-formed declaration never names one). Mutates `args` in
|
|
73
44
|
* place, replacing coerced members with their CastNode wrappers.
|
|
45
|
+
*
|
|
46
|
+
* NOT for a function that returns one of its arguments verbatim
|
|
47
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.returnsArg}):
|
|
48
|
+
* replacing the argument replaces the *returned value* too. Those go through
|
|
49
|
+
* `makeComparisonGroup` at emit time instead.
|
|
74
50
|
*/
|
|
75
51
|
export declare function coerceComparisonGroup(scope: Scope, comparesArgs: 'all' | readonly number[], args: ScalarPlanNode[]): void;
|
|
76
52
|
/** Create a synthetic CastNode wrapping `operand` with the given target type name. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"coercion.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,GACnB,CAAC,cAAc,EAAE,cAAc,CAAC,CAMlC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,EAAE,GACtB,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAQpC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,KAAK,GAAG,SAAS,MAAM,EAAE,EACvC,IAAI,EAAE,cAAc,EAAE,GACpB,IAAI,CAQN;AAED,sFAAsF;AACtF,wBAAgB,UAAU,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,GAChB,QAAQ,CAYV"}
|