@quereus/quereus 4.4.1 → 4.6.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/core/database-events.d.ts +99 -1
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +219 -3
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.js +1 -0
- package/dist/src/core/database-materialized-views-analysis.js.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 +29 -2
- package/dist/src/core/database-materialized-views-plan-builders.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 +7 -1
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +20 -5
- package/dist/src/core/database.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/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 +193 -37
- 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 +11 -3
- 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 +39 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +236 -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 +14 -5
- package/dist/src/index.js.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 +160 -44
- package/dist/src/parser/parser.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/coarsened-key.d.ts +4 -3
- package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.js +37 -3
- package/dist/src/planner/analysis/coarsened-key.js.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.d.ts +41 -13
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.js +51 -14
- 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 +13 -2
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +10 -14
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts +10 -4
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.js +28 -7
- package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.js +8 -27
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.d.ts +22 -3
- package/dist/src/planner/analysis/scalar-subqueries.d.ts.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.js +32 -3
- package/dist/src/planner/analysis/scalar-subqueries.js.map +1 -1
- package/dist/src/planner/analysis/set-op-type-merge.d.ts +64 -0
- package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -0
- package/dist/src/planner/analysis/set-op-type-merge.js +97 -0
- package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -0
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +65 -27
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/coercion.d.ts +54 -0
- package/dist/src/planner/building/coercion.d.ts.map +1 -0
- package/dist/src/planner/building/coercion.js +88 -0
- package/dist/src/planner/building/coercion.js.map +1 -0
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +5 -18
- package/dist/src/planner/building/constraint-builder.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 +23 -115
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/function-call.d.ts.map +1 -1
- package/dist/src/planner/building/function-call.js +13 -0
- package/dist/src/planner/building/function-call.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +53 -2
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-compound.d.ts.map +1 -1
- package/dist/src/planner/building/select-compound.js +10 -6
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/select-context.d.ts +7 -0
- package/dist/src/planner/building/select-context.d.ts.map +1 -1
- package/dist/src/planner/building/select-context.js +10 -40
- package/dist/src/planner/building/select-context.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 +112 -51
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/cost/conjunct-cost.d.ts +82 -0
- package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -0
- package/dist/src/planner/cost/conjunct-cost.js +107 -0
- package/dist/src/planner/cost/conjunct-cost.js.map +1 -0
- 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/mutation/propagate.d.ts.map +1 -1
- package/dist/src/planner/mutation/propagate.js +1 -0
- package/dist/src/planner/mutation/propagate.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +6 -0
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +10 -2
- 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 +24 -8
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- 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/async-gather-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.js +19 -8
- package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts +2 -0
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +17 -7
- 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/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/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 +12 -5
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +6 -0
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +10 -2
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts +25 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +38 -10
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +78 -0
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +73 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +87 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js +141 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -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 +2 -0
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +21 -8
- 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-type.d.ts +1 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +1 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +24 -0
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- 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 +2 -1
- 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.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +2 -1
- package/dist/src/planner/nodes/retrieve-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/set-operation-node.d.ts +68 -16
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +147 -26
- package/dist/src/planner/nodes/set-operation-node.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 +6 -0
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +10 -2
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +19 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +18 -2
- package/dist/src/planner/nodes/table-access-nodes.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 +9 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +126 -6
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +68 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js +343 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -0
- 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 +46 -0
- 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 +54 -13
- package/dist/src/planner/rules/access/rule-select-access-path.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 +9 -0
- package/dist/src/planner/rules/cache/rule-cte-optimization.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 +49 -49
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js +54 -58
- 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 +285 -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-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 +97 -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.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +15 -5
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +43 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +119 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +44 -3
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +142 -18
- 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 +73 -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 +205 -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 +10 -2
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +20 -2
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +18 -3
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
- package/dist/src/planner/rules/shared/access-leaf.d.ts +39 -0
- package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -0
- package/dist/src/planner/rules/shared/access-leaf.js +79 -0
- package/dist/src/planner/rules/shared/access-leaf.js.map +1 -0
- package/dist/src/planner/rules/shared/index-style-context.d.ts +17 -0
- package/dist/src/planner/rules/shared/index-style-context.d.ts.map +1 -1
- package/dist/src/planner/rules/shared/index-style-context.js +7 -0
- package/dist/src/planner/rules/shared/index-style-context.js.map +1 -1
- 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 +18 -8
- 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 +27 -10
- 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 +24 -6
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +243 -70
- 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 +87 -4
- package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
- package/dist/src/planner/stats/catalog-stats.js +250 -28
- 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 +36 -2
- 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/selectivity-combine.d.ts +53 -0
- package/dist/src/planner/stats/selectivity-combine.d.ts.map +1 -0
- package/dist/src/planner/stats/selectivity-combine.js +75 -0
- package/dist/src/planner/stats/selectivity-combine.js.map +1 -0
- 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/util/column-origins.d.ts +79 -0
- package/dist/src/planner/util/column-origins.d.ts.map +1 -0
- package/dist/src/planner/util/column-origins.js +150 -0
- package/dist/src/planner/util/column-origins.js.map +1 -0
- 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 +56 -17
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +82 -21
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts +20 -2
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +37 -3
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/planner/util/row-estimates.d.ts +28 -0
- package/dist/src/planner/util/row-estimates.d.ts.map +1 -0
- package/dist/src/planner/util/row-estimates.js +40 -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 +40 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.js +90 -9
- 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 +39 -1
- 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 +42 -0
- package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -0
- package/dist/src/runtime/emit/alter-schema-event.js +28 -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 +386 -154
- 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 +35 -3
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/asof-scan.js +8 -3
- package/dist/src/runtime/emit/asof-scan.js.map +1 -1
- package/dist/src/runtime/emit/between.d.ts.map +1 -1
- package/dist/src/runtime/emit/between.js +4 -38
- package/dist/src/runtime/emit/between.js.map +1 -1
- package/dist/src/runtime/emit/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +2 -23
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/bloom-join.js +6 -35
- package/dist/src/runtime/emit/bloom-join.js.map +1 -1
- package/dist/src/runtime/emit/case.d.ts.map +1 -1
- package/dist/src/runtime/emit/case.js +40 -6
- package/dist/src/runtime/emit/case.js.map +1 -1
- 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 +32 -8
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +90 -50
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- 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/filter.d.ts +18 -0
- package/dist/src/runtime/emit/filter.d.ts.map +1 -1
- package/dist/src/runtime/emit/filter.js +52 -10
- package/dist/src/runtime/emit/filter.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-key-extractor.d.ts +46 -0
- package/dist/src/runtime/emit/join-key-extractor.d.ts.map +1 -0
- package/dist/src/runtime/emit/join-key-extractor.js +60 -0
- package/dist/src/runtime/emit/join-key-extractor.js.map +1 -0
- package/dist/src/runtime/emit/join.d.ts.map +1 -1
- package/dist/src/runtime/emit/join.js +8 -46
- package/dist/src/runtime/emit/join.js.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.d.ts +29 -0
- package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -0
- package/dist/src/runtime/emit/key-set-semi-join.js +149 -0
- package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -0
- package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/merge-join.js +15 -8
- package/dist/src/runtime/emit/merge-join.js.map +1 -1
- package/dist/src/runtime/emit/operand-comparator.d.ts +70 -0
- package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -0
- package/dist/src/runtime/emit/operand-comparator.js +93 -0
- package/dist/src/runtime/emit/operand-comparator.js.map +1 -0
- package/dist/src/runtime/emit/scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/scan.js +11 -2
- package/dist/src/runtime/emit/scan.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/window.js +36 -23
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/parallel-driver.d.ts +5 -2
- package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
- package/dist/src/runtime/parallel-driver.js +6 -2
- package/dist/src/runtime/parallel-driver.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +2 -0
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/runtime/types.d.ts +7 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.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 +76 -20
- package/dist/src/schema/catalog-persistability.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +67 -2
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +194 -3
- package/dist/src/schema/catalog.js.map +1 -1
- 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/ddl-generator.d.ts.map +1 -1
- package/dist/src/schema/ddl-generator.js +19 -6
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/function.d.ts +40 -0
- 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/manager.d.ts +84 -7
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +153 -53
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +104 -28
- 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/types/builtin-types.d.ts +16 -0
- package/dist/src/types/builtin-types.d.ts.map +1 -1
- package/dist/src/types/builtin-types.js +76 -12
- 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/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 +41 -3
- package/dist/src/util/comparison.d.ts.map +1 -1
- package/dist/src/util/comparison.js +52 -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/best-access-plan.d.ts +87 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js +87 -0
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/capabilities.d.ts +1 -1
- package/dist/src/vtab/events.d.ts +5 -1
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js.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 +6 -4
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +10 -7
- 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 +232 -39
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +657 -519
- 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 +111 -16
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +154 -51
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +14 -2
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +53 -40
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/table.d.ts +1 -1
- package/dist/src/vtab/memory/table.d.ts.map +1 -1
- package/dist/src/vtab/memory/table.js +15 -3
- package/dist/src/vtab/memory/table.js.map +1 -1
- package/dist/src/vtab/module.d.ts +51 -21
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +10 -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
|
@@ -6,12 +6,13 @@ 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
13
|
import { 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';
|
|
17
18
|
export function buildAlterTableStmt(ctx, stmt) {
|
|
@@ -53,7 +54,10 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
53
54
|
// columns / non-determinism rejected; `new.<column>` accepted with its build
|
|
54
55
|
// deferred). This runs before building the backfill so a bare-column default
|
|
55
56
|
// is rejected here rather than silently resolving against the existing columns
|
|
56
|
-
// the backfill scope exposes.
|
|
57
|
+
// the backfill scope exposes. DEFAULT only: a GENERATED ALWAYS AS expression is
|
|
58
|
+
// written with bare column references by definition, so this validator would
|
|
59
|
+
// reject every legal one. Its determinism is checked inside
|
|
60
|
+
// `buildAddColumnBackfill` instead, with the generated-flavoured validator.
|
|
57
61
|
const defaultConstraint = column.constraints?.find(c => c.type === 'default');
|
|
58
62
|
if (defaultConstraint?.expr) {
|
|
59
63
|
const hasMutationContext = !!tableReference.tableSchema.mutationContext
|
|
@@ -61,12 +65,13 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
61
65
|
ctx.schemaManager.validateAddColumnDefault(defaultConstraint.expr, column.name, tableReference.tableSchema.name, hasMutationContext);
|
|
62
66
|
}
|
|
63
67
|
const backfill = buildAddColumnBackfill(ctx, tableReference, column);
|
|
64
|
-
// For the per-row (evaluator)
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// compiled when a backfill is
|
|
68
|
+
// For the per-row (evaluator) path — a non-foldable DEFAULT or a GENERATED ALWAYS AS
|
|
69
|
+
// expression — enforce any CHECK on the new column against each backfilled row by
|
|
70
|
+
// compiling the predicates here and evaluating them inside the per-row backfill hook
|
|
71
|
+
// (mirrors the NOT NULL per-row path) — a violating row aborts the ALTER before any
|
|
72
|
+
// tree/batch swap. The literal-default path is left to the post-backfill scan
|
|
73
|
+
// (`validateBackfillAgainstChecks`), so checks are only compiled when a backfill is
|
|
74
|
+
// present.
|
|
70
75
|
const checks = backfill ? buildAddColumnChecks(ctx, tableReference, column) : undefined;
|
|
71
76
|
return new AlterTableNode(ctx.scope, tableReference, {
|
|
72
77
|
type: 'addColumn',
|
|
@@ -176,26 +181,43 @@ export function buildAlterTableStmt(ctx, stmt) {
|
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
/**
|
|
179
|
-
* Compile the per-row backfill of an ADD COLUMN
|
|
180
|
-
* literal (e.g. `new.<col>`)
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
184
|
+
* Compile the per-row backfill of an ADD COLUMN that carries a per-row value source:
|
|
185
|
+
* a DEFAULT that does not fold to a literal (e.g. `new.<col>`), or a GENERATED ALWAYS
|
|
186
|
+
* AS expression (whatever its VIRTUAL / STORED spelling — this engine materializes a
|
|
187
|
+
* generated value at write time either way). Mirrors the single-source INSERT
|
|
188
|
+
* row-expansion and the view-write key default: the expression is built against the
|
|
189
|
+
* table's *existing* columns as the "supplied" row, so both `new.<col>` and the bare
|
|
190
|
+
* `<col>` a generated expression uses resolve to the existing row's sibling during
|
|
191
|
+
* backfill. Returns `undefined` when the column carries neither, or for a
|
|
192
|
+
* literal-folding DEFAULT (the module bulk-writes that from the column's
|
|
193
|
+
* `defaultValue`), so the common case allocates nothing.
|
|
185
194
|
*/
|
|
186
195
|
function buildAddColumnBackfill(ctx, tableReference, columnDef) {
|
|
196
|
+
// A column declares a DEFAULT or a GENERATED ALWAYS AS, never both —
|
|
197
|
+
// `columnDefToSchema` rejects the pair — so at most one arm applies.
|
|
198
|
+
const generatedExpr = columnDef.constraints?.find(c => c.type === 'generated')?.generated?.expr;
|
|
187
199
|
const defaultExpr = columnDef.constraints?.find(c => c.type === 'default')?.expr;
|
|
188
|
-
|
|
200
|
+
const sourceExpr = generatedExpr ?? defaultExpr;
|
|
201
|
+
if (!sourceExpr)
|
|
189
202
|
return undefined;
|
|
190
|
-
// Literal / NULL
|
|
191
|
-
|
|
203
|
+
// Literal / NULL DEFAULTs fold and are bulk-written by the module — no per-row node.
|
|
204
|
+
// Deliberately NOT taken on the generated arm: a generated column has no
|
|
205
|
+
// `defaultValue` for the module to bulk-write, so short-circuiting a constant
|
|
206
|
+
// generated expression (`generated always as (2)`) would leave every existing row
|
|
207
|
+
// NULL. The generated arm always builds the per-row node.
|
|
208
|
+
if (!generatedExpr && tryFoldLiteral(sourceExpr) !== undefined)
|
|
192
209
|
return undefined;
|
|
193
210
|
const tableSchema = tableReference.tableSchema;
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
// Report a bad generated expression the way CREATE TABLE reports it, before the
|
|
212
|
+
// compile below turns an unresolvable (or self-referencing) name into a generic
|
|
213
|
+
// "Column not found".
|
|
214
|
+
if (generatedExpr) {
|
|
215
|
+
validateAddColumnGeneratedRefs(generatedExpr, columnDef.name, tableSchema.columns, tableSchema.name);
|
|
216
|
+
}
|
|
217
|
+
// Fresh attributes for the existing columns, referenced only by this expression's
|
|
218
|
+
// column refs and resolved at runtime via the row slot the emitter installs over
|
|
219
|
+
// each existing row. Minting fresh (rather than reusing the table reference's
|
|
220
|
+
// attributes) keeps the node self-contained so the optimizer can't dangle it.
|
|
199
221
|
const rowAttrs = tableSchema.columns.map(column => ({
|
|
200
222
|
id: PlanNode.nextAttrId(),
|
|
201
223
|
name: column.name,
|
|
@@ -203,17 +225,33 @@ function buildAddColumnBackfill(ctx, tableReference, columnDef) {
|
|
|
203
225
|
sourceRelation: 'add-column-backfill',
|
|
204
226
|
}));
|
|
205
227
|
const rowScope = buildRowDefaultScope(ctx.scope, tableSchema.columns, rowAttrs);
|
|
206
|
-
const node = buildExpression({ ...ctx, scope: rowScope },
|
|
228
|
+
const node = buildExpression({ ...ctx, scope: rowScope }, sourceExpr);
|
|
229
|
+
// Same validator each arm's write-path build site uses, so an ALTER accepts exactly
|
|
230
|
+
// what the equivalent CREATE TABLE + INSERT accepts. Both honour
|
|
231
|
+
// `nondeterministic_schema`, so the escape hatch is unchanged.
|
|
207
232
|
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
208
|
-
|
|
233
|
+
if (generatedExpr) {
|
|
234
|
+
validateDeterministicGenerated(node, columnDef.name, tableSchema.name);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
validateDeterministicDefault(node, columnDef.name, tableSchema.name);
|
|
238
|
+
}
|
|
209
239
|
}
|
|
210
240
|
const rowDescriptor = [];
|
|
211
241
|
rowAttrs.forEach((attr, index) => { rowDescriptor[attr.id] = index; });
|
|
212
|
-
|
|
242
|
+
// The evaluated value has to reach storage in the new column's declared form, exactly as an
|
|
243
|
+
// INSERT's would. Skip the conversion when the expression's static type already IS that type
|
|
244
|
+
// (identity comparison — the registry hands out one shared LogicalType instance per type),
|
|
245
|
+
// mirroring `buildRowCoercion`: re-converting an already-converted value is destructive for
|
|
246
|
+
// JSON. See `AddColumnBackfill.coerceTo`.
|
|
247
|
+
const newColumnType = inferType(columnDef.dataType);
|
|
248
|
+
const coerceTo = node.getType().logicalType === newColumnType ? undefined : newColumnType;
|
|
249
|
+
return { node, rowDescriptor, coerceTo };
|
|
213
250
|
}
|
|
214
251
|
/**
|
|
215
|
-
* Compile the column-level CHECK predicates of an ADD COLUMN
|
|
216
|
-
*
|
|
252
|
+
* Compile the column-level CHECK predicates of an ADD COLUMN that backfills per row (a
|
|
253
|
+
* non-foldable DEFAULT or a GENERATED ALWAYS AS expression), so they can be enforced per
|
|
254
|
+
* backfilled row inside the backfill hook. Each
|
|
217
255
|
* predicate is built against a row scope covering the table's *existing* columns plus the
|
|
218
256
|
* *new* column, so a CHECK referencing the new column (bare `<col>` or `new.<col>`) and any
|
|
219
257
|
* existing sibling resolves. The new column sits at position `existingColumns.length` in the
|
|
@@ -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,uBAAu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C;QAC9C,IAAI,EAAE,eAAe,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG,CAAC,IAAK,CAAmB;QAC/E,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,kBAAkB,CAAC,GAAG,CAAC,IAAK,CAAC;KACxC,CAAC,CAAC,CAAC;IAEJ,MAAM,aAAa,GAAkB,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Scope } from '../scopes/scope.js';
|
|
2
|
+
import { CastNode } from '../nodes/scalar.js';
|
|
3
|
+
import type { ScalarPlanNode } from '../nodes/plan-node.js';
|
|
4
|
+
/**
|
|
5
|
+
* Plan-build cross-type coercion for comparison sites. Every construct that
|
|
6
|
+
* compares operands — `=` and friends, BETWEEN, IN value lists, simple CASE,
|
|
7
|
+
* and scalar builtins that declare a comparison group
|
|
8
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}) —
|
|
9
|
+
* reconciles its operands through this one module so none of them can drift
|
|
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.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Reconcile operands of a comparison whose plan-time types cannot be compared
|
|
20
|
+
* meaningfully as-is, by wrapping one side in a synthetic CastNode.
|
|
21
|
+
* Returns `[left, right]` — possibly with one side replaced by a CastNode.
|
|
22
|
+
*
|
|
23
|
+
* See {@link crossTypeCoercion} for the rule (object-physical vs anything else,
|
|
24
|
+
* then numeric vs textual) and why each side is chosen.
|
|
25
|
+
*/
|
|
26
|
+
export declare function insertCrossTypeCoercion(scope: Scope, left: ScalarPlanNode, right: ScalarPlanNode): [ScalarPlanNode, ScalarPlanNode];
|
|
27
|
+
/**
|
|
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.
|
|
34
|
+
*/
|
|
35
|
+
export declare function coerceComparisonSet(scope: Scope, probe: ScalarPlanNode, values: ScalarPlanNode[]): [ScalarPlanNode, ScalarPlanNode[]];
|
|
36
|
+
/**
|
|
37
|
+
* Apply {@link coerceComparisonSet} across the argument positions a scalar
|
|
38
|
+
* function declares as one comparison group
|
|
39
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}),
|
|
40
|
+
* so `nullif(json_col, '{"a":1}')` reconciles its operands exactly as
|
|
41
|
+
* `json_col = '{"a":1}'` does. The group's first member plays the probe role and
|
|
42
|
+
* the rest the value-list role; positions outside the argument list are ignored
|
|
43
|
+
* (defensive — a well-formed declaration never names one). Mutates `args` in
|
|
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.
|
|
50
|
+
*/
|
|
51
|
+
export declare function coerceComparisonGroup(scope: Scope, comparesArgs: 'all' | readonly number[], args: ScalarPlanNode[]): void;
|
|
52
|
+
/** Create a synthetic CastNode wrapping `operand` with the given target type name. */
|
|
53
|
+
export declare function wrapInCast(scope: Scope, operand: ScalarPlanNode, targetType: string): CastNode;
|
|
54
|
+
//# sourceMappingURL=coercion.d.ts.map
|
|
@@ -0,0 +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;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"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CastNode } from '../nodes/scalar.js';
|
|
2
|
+
import { comparisonGroupCoercions, comparisonGroupIndices, crossTypeCoercion } from '../../types/comparison-coercion.js';
|
|
3
|
+
/**
|
|
4
|
+
* Plan-build cross-type coercion for comparison sites. Every construct that
|
|
5
|
+
* compares operands — `=` and friends, BETWEEN, IN value lists, simple CASE,
|
|
6
|
+
* and scalar builtins that declare a comparison group
|
|
7
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}) —
|
|
8
|
+
* reconciles its operands through this one module so none of them can drift
|
|
9
|
+
* from the others.
|
|
10
|
+
*
|
|
11
|
+
* This file owns only the *rewrite*: which operand gets wrapped in a synthetic
|
|
12
|
+
* `CastNode`. The decision of which operand converts and to what lives in
|
|
13
|
+
* `types/comparison-coercion.ts`, shared with the emit-time consumer
|
|
14
|
+
* (`runtime/emit/operand-comparator.ts` `makeComparisonGroup`) that serves the
|
|
15
|
+
* builtins which return one of their arguments and so cannot be rewritten here.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Reconcile operands of a comparison whose plan-time types cannot be compared
|
|
19
|
+
* meaningfully as-is, by wrapping one side in a synthetic CastNode.
|
|
20
|
+
* Returns `[left, right]` — possibly with one side replaced by a CastNode.
|
|
21
|
+
*
|
|
22
|
+
* See {@link crossTypeCoercion} for the rule (object-physical vs anything else,
|
|
23
|
+
* then numeric vs textual) and why each side is chosen.
|
|
24
|
+
*/
|
|
25
|
+
export function insertCrossTypeCoercion(scope, left, right) {
|
|
26
|
+
const coercion = crossTypeCoercion(left.getType().logicalType, right.getType().logicalType);
|
|
27
|
+
if (!coercion)
|
|
28
|
+
return [left, right];
|
|
29
|
+
return coercion.side === 'left'
|
|
30
|
+
? [wrapInCast(scope, left, coercion.target.name), right]
|
|
31
|
+
: [left, wrapInCast(scope, right, coercion.target.name)];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Apply {@link comparisonGroupCoercions} across the one-probe-against-many-values
|
|
35
|
+
* shape shared by an IN value list, a simple CASE and a scalar builtin's
|
|
36
|
+
* comparison group, so `json_col in ('{"a":1}')`, `int_col in ('1')` and
|
|
37
|
+
* `case int_col when '1' …` all agree with the `=` spelling of the same
|
|
38
|
+
* comparison. See that function for the probe-vs-value asymmetry and the one
|
|
39
|
+
* documented gap it leaves.
|
|
40
|
+
*/
|
|
41
|
+
export function coerceComparisonSet(scope, probe, values) {
|
|
42
|
+
const nodes = [probe, ...values];
|
|
43
|
+
const targets = comparisonGroupCoercions(nodes.map(node => node.getType().logicalType));
|
|
44
|
+
const coerced = nodes.map((node, i) => {
|
|
45
|
+
const target = targets[i];
|
|
46
|
+
return target ? wrapInCast(scope, node, target.name) : node;
|
|
47
|
+
});
|
|
48
|
+
return [coerced[0], coerced.slice(1)];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Apply {@link coerceComparisonSet} across the argument positions a scalar
|
|
52
|
+
* function declares as one comparison group
|
|
53
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.comparesArgs}),
|
|
54
|
+
* so `nullif(json_col, '{"a":1}')` reconciles its operands exactly as
|
|
55
|
+
* `json_col = '{"a":1}'` does. The group's first member plays the probe role and
|
|
56
|
+
* the rest the value-list role; positions outside the argument list are ignored
|
|
57
|
+
* (defensive — a well-formed declaration never names one). Mutates `args` in
|
|
58
|
+
* place, replacing coerced members with their CastNode wrappers.
|
|
59
|
+
*
|
|
60
|
+
* NOT for a function that returns one of its arguments verbatim
|
|
61
|
+
* ({@link import('../../schema/function.js').BaseFunctionSchema.returnsArg}):
|
|
62
|
+
* replacing the argument replaces the *returned value* too. Those go through
|
|
63
|
+
* `makeComparisonGroup` at emit time instead.
|
|
64
|
+
*/
|
|
65
|
+
export function coerceComparisonGroup(scope, comparesArgs, args) {
|
|
66
|
+
const indices = comparisonGroupIndices(comparesArgs, args.length);
|
|
67
|
+
if (indices.length < 2)
|
|
68
|
+
return;
|
|
69
|
+
const [probeIdx, ...valueIdx] = indices;
|
|
70
|
+
const [probe, values] = coerceComparisonSet(scope, args[probeIdx], valueIdx.map(i => args[i]));
|
|
71
|
+
args[probeIdx] = probe;
|
|
72
|
+
valueIdx.forEach((argIdx, j) => { args[argIdx] = values[j]; });
|
|
73
|
+
}
|
|
74
|
+
/** Create a synthetic CastNode wrapping `operand` with the given target type name. */
|
|
75
|
+
export function wrapInCast(scope, operand, targetType) {
|
|
76
|
+
// Synthesise an AST.CastExpr. `targetType` is the only field CastNode itself
|
|
77
|
+
// reads, but `formatExpression` renders a node from its AST rather than from
|
|
78
|
+
// its children — a `literal null` placeholder here made every coerced operand
|
|
79
|
+
// print as `cast(null as integer)` in EXPLAIN while the real operand child was
|
|
80
|
+
// intact. Carrying the operand's own AST keeps the rendering truthful.
|
|
81
|
+
const syntheticExpr = {
|
|
82
|
+
type: 'cast',
|
|
83
|
+
expr: operand.expression,
|
|
84
|
+
targetType,
|
|
85
|
+
};
|
|
86
|
+
return new CastNode(scope, syntheticExpr, operand);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=coercion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coercion.js","sourceRoot":"","sources":["../../../../src/planner/building/coercion.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEzH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACtC,KAAY,EACZ,IAAoB,EACpB,KAAqB;IAErB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC;IAC5F,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,OAAO,QAAQ,CAAC,IAAI,KAAK,MAAM;QAC9B,CAA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MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"constraint-builder.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/constraint-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAA+B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAE7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAoBhD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,SAAS,EAAE,EAC1B,aAAa,EAAE,SAAS,EAAE,EAC1B,kBAAkB,EAAE,aAAa,EACjC,iBAAiB,GAAE,SAAS,EAAO;AACnC;;;;;GAKG;AACH,qBAAqB,GAAE,aAAa,CAAC,mBAAmB,CAAM,GAC7D,eAAe,EAAE,CA0KnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,SAAS,EAAE,EAC1B,iBAAiB,GAAE,SAAS,EAAO;AACnC;;;;;;;;GAQG;AACH,sBAAsB,CAAC,EAAE,KAAK,GAC7B,kBAAkB,EAAE,CAqDtB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RowOpFlag, writeRowRelationCorrelation } from '../../schema/table.js';
|
|
2
2
|
import { RegisteredScope } from '../scopes/registered.js';
|
|
3
3
|
import { buildExpression } from './expression.js';
|
|
4
|
-
import { PlanNodeType } from '../nodes/plan-node-type.js';
|
|
5
4
|
import { ColumnReferenceNode } from '../nodes/reference.js';
|
|
5
|
+
import { hasRelationalDescendant } from '../analysis/scalar-subqueries.js';
|
|
6
6
|
import { TableReferenceNode } from '../nodes/reference.js';
|
|
7
7
|
import { validateDeterministicConstraint } from '../validation/determinism-validator.js';
|
|
8
8
|
import { columnSchemaToScalarType } from '../type-utils.js';
|
|
@@ -138,11 +138,12 @@ additionalConstraints = []) {
|
|
|
138
138
|
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
139
139
|
validateDeterministicConstraint(expression, constraintName, tableSchema.name);
|
|
140
140
|
}
|
|
141
|
-
//
|
|
142
|
-
//
|
|
141
|
+
// Auto-defer when the expression reads a relation — a subquery of any shape
|
|
142
|
+
// means the check cannot be decided from the mutating row alone — or when it
|
|
143
|
+
// references committed.* state (which necessarily implies a subquery, but
|
|
143
144
|
// this defensive check ensures committed-ref constraints are always deferred
|
|
144
145
|
// even if subquery detection logic changes).
|
|
145
|
-
const needsDeferred =
|
|
146
|
+
const needsDeferred = hasRelationalDescendant(expression) || containsCommittedRef(expression);
|
|
146
147
|
return {
|
|
147
148
|
constraint,
|
|
148
149
|
expression,
|
|
@@ -233,20 +234,6 @@ defaultRowContextScope) {
|
|
|
233
234
|
}
|
|
234
235
|
return result;
|
|
235
236
|
}
|
|
236
|
-
function containsSubquery(expr) {
|
|
237
|
-
const stack = [expr];
|
|
238
|
-
while (stack.length) {
|
|
239
|
-
const n = stack.pop();
|
|
240
|
-
if (n.nodeType === PlanNodeType.ScalarSubquery || n.nodeType === PlanNodeType.Exists) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
for (const c of n.getChildren()) {
|
|
244
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
245
|
-
stack.push(c);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return false;
|
|
249
|
-
}
|
|
250
237
|
/**
|
|
251
238
|
* Walks the full expression tree (descending into subquery plan children)
|
|
252
239
|
* to find any TableReferenceNode with readCommitted === true.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constraint-builder.js","sourceRoot":"","sources":["../../../../src/planner/building/constraint-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constraint-builder.js","sourceRoot":"","sources":["../../../../src/planner/building/constraint-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAA8B,MAAM,iCAAiC,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D;;GAEG;AACH,SAAS,qBAAqB,CAAC,UAA+B,EAAE,SAAoB;IAClF,2EAA2E;IAC3E,OAAO,CAAC,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAoB,EACpB,WAAwB,EACxB,SAAoB,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MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,EAAE,WAA6B,CAAmB,CAAC;QAClG,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,WAA6B,EAAE,WAAW,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,IAAoB;IAChD,MAAM,KAAK,GAAe,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;QACvB,IAAI,CAAC,YAAY,kBAAkB,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import type * as AST from '../../parser/ast.js';
|
|
2
2
|
import type { PlanningContext } from '../planning-context.js';
|
|
3
|
+
import { BinaryOpNode } from '../nodes/scalar.js';
|
|
3
4
|
import type { ScalarPlanNode } from '../nodes/plan-node.js';
|
|
5
|
+
import { type Scope } from '../scopes/scope.js';
|
|
6
|
+
/**
|
|
7
|
+
* Build a comparison `BinaryOpNode` the ONE way every comparison site must: insert
|
|
8
|
+
* the cross-type coercion casts (so a numeric side and a textual side compare
|
|
9
|
+
* numerically, an object side and a textual side structurally), then force
|
|
10
|
+
* `generateType`'s lazily-cached collation-lattice validation so an ambiguous
|
|
11
|
+
* collation errors at prepare time rather than as the emitter's backstop.
|
|
12
|
+
*
|
|
13
|
+
* `expression` is the source spelling and is deliberately NOT rewritten to match a
|
|
14
|
+
* coerced operand — EXPLAIN keeps showing what the user wrote.
|
|
15
|
+
*
|
|
16
|
+
* Callers: the `binary` case below, and `buildUsingCondition` (`./select.ts`), which
|
|
17
|
+
* desugars `using (c)` into this node — that shared construction is what keeps a
|
|
18
|
+
* USING pair from drifting away from the spelled-out `l.c = r.c`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildComparison(scope: Scope, expression: AST.BinaryExpr, left: ScalarPlanNode, right: ScalarPlanNode): BinaryOpNode;
|
|
4
21
|
/**
|
|
5
22
|
* Builds an expression plan node from an AST expression.
|
|
6
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAe,YAAY,EAAiE,MAAM,oBAAoB,CAAC;AAI9H,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAKhF,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA4C3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,GAAG,CAAC,UAAU,EAC1B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,cAAc,GACnB,YAAY,CAKd;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,CAAC,UAAU,EAAE,eAAe,GAAE,OAAe,GAAG,cAAc,CAwN5H"}
|