@quereus/quereus 4.11.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/common/type-inference.d.ts +12 -6
- package/dist/src/common/type-inference.d.ts.map +1 -1
- package/dist/src/common/type-inference.js +12 -24
- package/dist/src/common/type-inference.js.map +1 -1
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +7 -5
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-events.d.ts +4 -3
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +4 -3
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.d.ts +1 -3
- package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.js +1 -11
- 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 +12 -10
- package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +13 -2
- 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 +14 -2
- package/dist/src/core/derived-row-validator.js.map +1 -1
- package/dist/src/core/param.d.ts +9 -0
- package/dist/src/core/param.d.ts.map +1 -1
- package/dist/src/core/param.js +21 -1
- package/dist/src/core/param.js.map +1 -1
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +38 -15
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/func/builtins/aggregate.d.ts.map +1 -1
- package/dist/src/func/builtins/aggregate.js +7 -2
- 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 +27 -11
- package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
- package/dist/src/func/builtins/datetime.d.ts.map +1 -1
- package/dist/src/func/builtins/datetime.js +8 -3
- 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 +9 -29
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/json-tvf.d.ts.map +1 -1
- package/dist/src/func/builtins/json-tvf.js +14 -7
- package/dist/src/func/builtins/json-tvf.js.map +1 -1
- package/dist/src/func/builtins/return-types.d.ts +29 -0
- package/dist/src/func/builtins/return-types.d.ts.map +1 -1
- package/dist/src/func/builtins/return-types.js +4 -1
- package/dist/src/func/builtins/return-types.js.map +1 -1
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +22 -67
- 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 +26 -16
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +8 -5
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/parser/visitor.d.ts +16 -0
- package/dist/src/parser/visitor.d.ts.map +1 -1
- package/dist/src/parser/visitor.js +16 -0
- package/dist/src/parser/visitor.js.map +1 -1
- package/dist/src/planner/analysis/assertion-plan.d.ts +33 -0
- package/dist/src/planner/analysis/assertion-plan.d.ts.map +1 -0
- package/dist/src/planner/analysis/assertion-plan.js +39 -0
- package/dist/src/planner/analysis/assertion-plan.js.map +1 -0
- package/dist/src/planner/analysis/binary-operator-class.d.ts +55 -0
- package/dist/src/planner/analysis/binary-operator-class.d.ts.map +1 -0
- package/dist/src/planner/analysis/binary-operator-class.js +57 -0
- package/dist/src/planner/analysis/binary-operator-class.js.map +1 -0
- package/dist/src/planner/analysis/binding-extractor.d.ts +9 -3
- package/dist/src/planner/analysis/binding-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/binding-extractor.js +11 -16
- package/dist/src/planner/analysis/binding-extractor.js.map +1 -1
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
- package/dist/src/planner/analysis/change-scope.js +19 -6
- package/dist/src/planner/analysis/change-scope.js.map +1 -1
- package/dist/src/planner/analysis/check-extraction.d.ts +1 -7
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
- package/dist/src/planner/analysis/check-extraction.js.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.d.ts +17 -0
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.js +17 -5
- package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +18 -18
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts +11 -7
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +11 -7
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/equi-correlation.d.ts +1 -1
- package/dist/src/planner/analysis/equi-correlation.js +1 -1
- package/dist/src/planner/analysis/expression-fingerprint.d.ts.map +1 -1
- package/dist/src/planner/analysis/expression-fingerprint.js +0 -2
- package/dist/src/planner/analysis/expression-fingerprint.js.map +1 -1
- package/dist/src/planner/analysis/key-filter.d.ts.map +1 -1
- package/dist/src/planner/analysis/key-filter.js +2 -3
- package/dist/src/planner/analysis/key-filter.js.map +1 -1
- package/dist/src/planner/analysis/relation-key.d.ts +104 -0
- package/dist/src/planner/analysis/relation-key.d.ts.map +1 -0
- package/dist/src/planner/analysis/relation-key.js +121 -0
- package/dist/src/planner/analysis/relation-key.js.map +1 -0
- package/dist/src/planner/analysis/scalar-param-usage.d.ts.map +1 -1
- package/dist/src/planner/analysis/scalar-param-usage.js +12 -4
- package/dist/src/planner/analysis/scalar-param-usage.js.map +1 -1
- package/dist/src/planner/analysis/set-op-type-merge.d.ts +9 -3
- package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -1
- package/dist/src/planner/analysis/set-op-type-merge.js +22 -8
- package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -1
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +31 -23
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/analyze.d.ts.map +1 -1
- package/dist/src/planner/building/analyze.js +21 -0
- package/dist/src/planner/building/analyze.js.map +1 -1
- package/dist/src/planner/building/block.d.ts.map +1 -1
- package/dist/src/planner/building/block.js +222 -82
- package/dist/src/planner/building/block.js.map +1 -1
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +5 -3
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/delete.js +1 -1
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/expression.d.ts.map +1 -1
- package/dist/src/planner/building/expression.js +11 -3
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts +16 -6
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +43 -20
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/generated-column-scope.d.ts +58 -0
- package/dist/src/planner/building/generated-column-scope.d.ts.map +1 -0
- package/dist/src/planner/building/generated-column-scope.js +117 -0
- package/dist/src/planner/building/generated-column-scope.js.map +1 -0
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +20 -28
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +73 -132
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +405 -81
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-modifiers.d.ts +37 -8
- package/dist/src/planner/building/select-modifiers.d.ts.map +1 -1
- package/dist/src/planner/building/select-modifiers.js +8 -9
- package/dist/src/planner/building/select-modifiers.js.map +1 -1
- package/dist/src/planner/building/select-ordinal.d.ts +6 -0
- package/dist/src/planner/building/select-ordinal.d.ts.map +1 -1
- package/dist/src/planner/building/select-ordinal.js +1 -1
- package/dist/src/planner/building/select-ordinal.js.map +1 -1
- package/dist/src/planner/building/select-window.d.ts +2 -2
- package/dist/src/planner/building/select-window.d.ts.map +1 -1
- package/dist/src/planner/building/select-window.js +82 -101
- package/dist/src/planner/building/select-window.js.map +1 -1
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +78 -33
- 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 +14 -8
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.js +329 -14
- package/dist/src/planner/building/view-mutation-builder.js.map +1 -1
- package/dist/src/planner/building/with.d.ts +6 -0
- package/dist/src/planner/building/with.d.ts.map +1 -1
- package/dist/src/planner/building/with.js +52 -3
- package/dist/src/planner/building/with.js.map +1 -1
- package/dist/src/planner/cache/correlation-detector.d.ts.map +1 -1
- package/dist/src/planner/cache/correlation-detector.js +44 -17
- package/dist/src/planner/cache/correlation-detector.js.map +1 -1
- package/dist/src/planner/framework/physical-utils.d.ts +6 -0
- package/dist/src/planner/framework/physical-utils.d.ts.map +1 -1
- package/dist/src/planner/framework/physical-utils.js +6 -0
- package/dist/src/planner/framework/physical-utils.js.map +1 -1
- package/dist/src/planner/mutation/lens-enforcement.d.ts +123 -0
- package/dist/src/planner/mutation/lens-enforcement.d.ts.map +1 -1
- package/dist/src/planner/mutation/lens-enforcement.js +362 -5
- package/dist/src/planner/mutation/lens-enforcement.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/nodes/alter-table-node.d.ts +15 -11
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.js +5 -0
- package/dist/src/planner/nodes/alter-table-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 +7 -0
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.d.ts +16 -0
- package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.d.ts +1 -1
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +1 -1
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/pragma.d.ts.map +1 -1
- package/dist/src/planner/nodes/pragma.js +5 -2
- package/dist/src/planner/nodes/pragma.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +9 -1
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +117 -91
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/sequence-node.d.ts +50 -0
- package/dist/src/planner/nodes/sequence-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/sequence-node.js +96 -0
- package/dist/src/planner/nodes/sequence-node.js.map +1 -0
- package/dist/src/planner/nodes/values-node.d.ts +8 -0
- package/dist/src/planner/nodes/values-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/values-node.js +29 -6
- package/dist/src/planner/nodes/values-node.js.map +1 -1
- package/dist/src/planner/nodes/view-mutation-node.d.ts +43 -1
- package/dist/src/planner/nodes/view-mutation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/view-mutation-node.js +27 -6
- package/dist/src/planner/nodes/view-mutation-node.js.map +1 -1
- package/dist/src/planner/nodes/window-node.d.ts +33 -4
- package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-node.js +80 -36
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/planning-context.d.ts +38 -1
- package/dist/src/planner/planning-context.d.ts.map +1 -1
- 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 +8 -3
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js +18 -12
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +4 -3
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.js +6 -0
- package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -1
- package/dist/src/planner/scopes/param.d.ts.map +1 -1
- package/dist/src/planner/scopes/param.js +10 -5
- package/dist/src/planner/scopes/param.js.map +1 -1
- package/dist/src/planner/util/ind-utils.d.ts +25 -8
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +53 -10
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts +7 -7
- package/dist/src/planner/util/key-utils.js +9 -9
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/runtime/delta-executor.d.ts.map +1 -1
- package/dist/src/runtime/delta-executor.js +7 -2
- package/dist/src/runtime/delta-executor.js.map +1 -1
- package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
- package/dist/src/runtime/emit/add-constraint.js +50 -15
- package/dist/src/runtime/emit/add-constraint.js.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.d.ts +2 -43
- package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.js +2 -53
- package/dist/src/runtime/emit/alter-schema-event.js.map +1 -1
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +59 -24
- 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 +7 -0
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/assertion-rename-helpers.d.ts.map +1 -1
- package/dist/src/runtime/emit/assertion-rename-helpers.js +2 -3
- package/dist/src/runtime/emit/assertion-rename-helpers.js.map +1 -1
- package/dist/src/runtime/emit/binary.d.ts +5 -0
- package/dist/src/runtime/emit/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +22 -22
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/block.d.ts.map +1 -1
- package/dist/src/runtime/emit/block.js +9 -3
- package/dist/src/runtime/emit/block.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +5 -6
- 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 +71 -70
- package/dist/src/runtime/emit/create-assertion.js.map +1 -1
- package/dist/src/runtime/emit/create-index.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-index.js +8 -3
- package/dist/src/runtime/emit/create-index.js.map +1 -1
- package/dist/src/runtime/emit/create-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-table.js +20 -10
- package/dist/src/runtime/emit/create-table.js.map +1 -1
- package/dist/src/runtime/emit/create-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-view.js +51 -44
- package/dist/src/runtime/emit/create-view.js.map +1 -1
- package/dist/src/runtime/emit/ddl-event-scope.d.ts +71 -0
- package/dist/src/runtime/emit/ddl-event-scope.d.ts.map +1 -0
- package/dist/src/runtime/emit/ddl-event-scope.js +80 -0
- package/dist/src/runtime/emit/ddl-event-scope.js.map +1 -0
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +23 -23
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.js +23 -17
- package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
- package/dist/src/runtime/emit/drop-index.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-index.js +7 -2
- 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 +16 -10
- 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 +50 -43
- package/dist/src/runtime/emit/drop-view.js.map +1 -1
- package/dist/src/runtime/emit/insert.d.ts.map +1 -1
- package/dist/src/runtime/emit/insert.js +2 -1
- package/dist/src/runtime/emit/insert.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view.js +87 -67
- package/dist/src/runtime/emit/materialized-view.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.d.ts +8 -0
- package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +128 -25
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/runtime/emit/sequence.d.ts +17 -0
- package/dist/src/runtime/emit/sequence.d.ts.map +1 -0
- package/dist/src/runtime/emit/sequence.js +40 -0
- package/dist/src/runtime/emit/sequence.js.map +1 -0
- package/dist/src/runtime/emit/set-object-tags.d.ts.map +1 -1
- package/dist/src/runtime/emit/set-object-tags.js +40 -32
- package/dist/src/runtime/emit/set-object-tags.js.map +1 -1
- package/dist/src/runtime/emit/table-valued-function.d.ts.map +1 -1
- package/dist/src/runtime/emit/table-valued-function.js +3 -2
- package/dist/src/runtime/emit/table-valued-function.js.map +1 -1
- package/dist/src/runtime/emit/update.js +3 -3
- package/dist/src/runtime/emit/update.js.map +1 -1
- package/dist/src/runtime/emit/view-mutation.d.ts.map +1 -1
- package/dist/src/runtime/emit/view-mutation.js +45 -3
- package/dist/src/runtime/emit/view-mutation.js.map +1 -1
- package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +9 -10
- package/dist/src/runtime/foreign-key-actions.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +3 -2
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/runtime/row-constraints.d.ts +14 -8
- package/dist/src/runtime/row-constraints.d.ts.map +1 -1
- package/dist/src/runtime/row-constraints.js +41 -15
- package/dist/src/runtime/row-constraints.js.map +1 -1
- package/dist/src/runtime/strict-representation.d.ts +11 -6
- package/dist/src/runtime/strict-representation.d.ts.map +1 -1
- package/dist/src/runtime/strict-representation.js +1 -44
- package/dist/src/runtime/strict-representation.js.map +1 -1
- package/dist/src/schema/assertion.d.ts +25 -2
- package/dist/src/schema/assertion.d.ts.map +1 -1
- package/dist/src/schema/assertion.js.map +1 -1
- package/dist/src/schema/catalog-rendering.d.ts +38 -0
- package/dist/src/schema/catalog-rendering.d.ts.map +1 -0
- package/dist/src/schema/catalog-rendering.js +171 -0
- package/dist/src/schema/catalog-rendering.js.map +1 -0
- package/dist/src/schema/catalog.d.ts +69 -3
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +124 -19
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/column-source-resolver.d.ts +9 -5
- package/dist/src/schema/column-source-resolver.d.ts.map +1 -1
- package/dist/src/schema/column-source-resolver.js +9 -5
- package/dist/src/schema/column-source-resolver.js.map +1 -1
- package/dist/src/schema/constraint-builder.d.ts +13 -10
- package/dist/src/schema/constraint-builder.d.ts.map +1 -1
- package/dist/src/schema/constraint-builder.js +45 -17
- package/dist/src/schema/constraint-builder.js.map +1 -1
- package/dist/src/schema/declared-schema-manager.d.ts +50 -0
- package/dist/src/schema/declared-schema-manager.d.ts.map +1 -1
- package/dist/src/schema/declared-schema-manager.js +52 -0
- package/dist/src/schema/declared-schema-manager.js.map +1 -1
- package/dist/src/schema/expr-scope/frame.d.ts +65 -0
- package/dist/src/schema/expr-scope/frame.d.ts.map +1 -0
- package/dist/src/schema/expr-scope/frame.js +104 -0
- package/dist/src/schema/expr-scope/frame.js.map +1 -0
- package/dist/src/schema/expr-scope/walk.d.ts +40 -0
- package/dist/src/schema/expr-scope/walk.d.ts.map +1 -0
- package/dist/src/schema/expr-scope/walk.js +260 -0
- package/dist/src/schema/expr-scope/walk.js.map +1 -0
- package/dist/src/schema/generated-column-refs.d.ts +41 -0
- package/dist/src/schema/generated-column-refs.d.ts.map +1 -0
- package/dist/src/schema/generated-column-refs.js +124 -0
- package/dist/src/schema/generated-column-refs.js.map +1 -0
- package/dist/src/schema/lens-ack.d.ts.map +1 -1
- package/dist/src/schema/lens-ack.js +5 -2
- package/dist/src/schema/lens-ack.js.map +1 -1
- package/dist/src/schema/lens-compiler.d.ts.map +1 -1
- package/dist/src/schema/lens-compiler.js +9 -1
- package/dist/src/schema/lens-compiler.js.map +1 -1
- package/dist/src/schema/lens-prover.d.ts +7 -2
- package/dist/src/schema/lens-prover.d.ts.map +1 -1
- package/dist/src/schema/lens-prover.js +105 -11
- package/dist/src/schema/lens-prover.js.map +1 -1
- package/dist/src/schema/lens.d.ts +12 -0
- package/dist/src/schema/lens.d.ts.map +1 -1
- package/dist/src/schema/lens.js +10 -0
- package/dist/src/schema/lens.js.map +1 -1
- package/dist/src/schema/manager.d.ts +35 -1
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +125 -26
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename/self-qualifier-strip.d.ts +16 -10
- package/dist/src/schema/rename/self-qualifier-strip.d.ts.map +1 -1
- package/dist/src/schema/rename/self-qualifier-strip.js +30 -213
- package/dist/src/schema/rename/self-qualifier-strip.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts +4 -3
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +4 -3
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts +54 -6
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +108 -42
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/schema-hasher.d.ts +12 -0
- package/dist/src/schema/schema-hasher.d.ts.map +1 -1
- package/dist/src/schema/schema-hasher.js +28 -10
- package/dist/src/schema/schema-hasher.js.map +1 -1
- package/dist/src/schema/table.d.ts +74 -19
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +133 -71
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/types/comparison-coercion.d.ts +5 -1
- package/dist/src/types/comparison-coercion.d.ts.map +1 -1
- package/dist/src/types/comparison-coercion.js +21 -5
- package/dist/src/types/comparison-coercion.js.map +1 -1
- package/dist/src/types/representation.d.ts +65 -0
- package/dist/src/types/representation.d.ts.map +1 -0
- package/dist/src/types/representation.js +63 -0
- package/dist/src/types/representation.js.map +1 -0
- package/dist/src/types/validation.d.ts +76 -22
- package/dist/src/types/validation.d.ts.map +1 -1
- package/dist/src/types/validation.js +110 -31
- package/dist/src/types/validation.js.map +1 -1
- package/dist/src/vtab/best-access-plan.d.ts +10 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js +16 -0
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/capabilities.d.ts +72 -4
- package/dist/src/vtab/capabilities.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +17 -13
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/module.d.ts +13 -7
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/src/planner/nodes/array-index-node.d.ts +0 -22
- package/dist/src/planner/nodes/array-index-node.d.ts.map +0 -1
- package/dist/src/planner/nodes/array-index-node.js +0 -41
- package/dist/src/planner/nodes/array-index-node.js.map +0 -1
- package/dist/src/runtime/emit/array-index.d.ts +0 -5
- package/dist/src/runtime/emit/array-index.d.ts.map +0 -1
- package/dist/src/runtime/emit/array-index.js +0 -22
- package/dist/src/runtime/emit/array-index.js.map +0 -1
|
@@ -31,6 +31,22 @@ export interface AstVisitorCallbacks {
|
|
|
31
31
|
/**
|
|
32
32
|
* Performs a depth-first traversal of the AST.
|
|
33
33
|
*
|
|
34
|
+
* NOTE: `schema/expr-scope/walk.ts` is a second traversal over these same node
|
|
35
|
+
* kinds — scope-aware, and used only by the schema-time expression analyses
|
|
36
|
+
* (the CHECK self-qualifier strip and the generated-column reference
|
|
37
|
+
* collector). The two are deliberately NOT unified: its FROM-frame stack has
|
|
38
|
+
* no place in a generic visitor. But a change to the AST node shapes has to be
|
|
39
|
+
* reflected in both. Grep either file's `NOTE:` to find the other.
|
|
40
|
+
*
|
|
41
|
+
* Their reach is not identical, and this traversal is the narrower one: it skips
|
|
42
|
+
* window frame bound expressions (the `TODO` at the `windowDefinition` arm below),
|
|
43
|
+
* `SelectStmt.defaults`, and a DML's `returning` / `upsertClauses` /
|
|
44
|
+
* `contextValues`. That is a live defect, not a shrug — `../schema/manager.ts`'s
|
|
45
|
+
* declaration-time determinism gate walks with this traversal, so a
|
|
46
|
+
* non-deterministic call hiding in any of those subtrees is accepted at
|
|
47
|
+
* `CREATE TABLE`. Owned by `bug-ast-traversal-misses-expression-subtrees`; do not
|
|
48
|
+
* widen piecemeal without pricing what the four `manager.ts` callers then see.
|
|
49
|
+
*
|
|
34
50
|
* @param node The starting AST node.
|
|
35
51
|
* @param callbacks An object containing visitor functions for different node types.
|
|
36
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../../../src/parser/visitor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AAMrC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC;IAClD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;IAEvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC;IACvD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC;IACvD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC;IACvD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC;IACvD,WAAW,CAAC,EAAE,CAAC,I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AC,aAAa,KAAK,IAAI,CAAC;CACnD;AACD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,EAAE,SAAS,EAAE,mBAAmB,GAAG,IAAI,CA4L/F"}
|
|
@@ -4,6 +4,22 @@ const warnLog = log.extend('warn');
|
|
|
4
4
|
/**
|
|
5
5
|
* Performs a depth-first traversal of the AST.
|
|
6
6
|
*
|
|
7
|
+
* NOTE: `schema/expr-scope/walk.ts` is a second traversal over these same node
|
|
8
|
+
* kinds — scope-aware, and used only by the schema-time expression analyses
|
|
9
|
+
* (the CHECK self-qualifier strip and the generated-column reference
|
|
10
|
+
* collector). The two are deliberately NOT unified: its FROM-frame stack has
|
|
11
|
+
* no place in a generic visitor. But a change to the AST node shapes has to be
|
|
12
|
+
* reflected in both. Grep either file's `NOTE:` to find the other.
|
|
13
|
+
*
|
|
14
|
+
* Their reach is not identical, and this traversal is the narrower one: it skips
|
|
15
|
+
* window frame bound expressions (the `TODO` at the `windowDefinition` arm below),
|
|
16
|
+
* `SelectStmt.defaults`, and a DML's `returning` / `upsertClauses` /
|
|
17
|
+
* `contextValues`. That is a live defect, not a shrug — `../schema/manager.ts`'s
|
|
18
|
+
* declaration-time determinism gate walks with this traversal, so a
|
|
19
|
+
* non-deterministic call hiding in any of those subtrees is accepted at
|
|
20
|
+
* `CREATE TABLE`. Owned by `bug-ast-traversal-misses-expression-subtrees`; do not
|
|
21
|
+
* widen piecemeal without pricing what the four `manager.ts` callers then see.
|
|
22
|
+
*
|
|
7
23
|
* @param node The starting AST node.
|
|
8
24
|
* @param callbacks An object containing visitor functions for different node types.
|
|
9
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitor.js","sourceRoot":"","sources":["../../../src/parser/visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,GAAG,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CAAC,CAAC;YAC1C,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC1C,MAAM;QACP,CAAC;QACD,oGAAoG;QACpG,KAAK,SAAS,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW;YACf,MAAM;QACP,4EAA4E;QAC5E,qCAAqC;QACrC,KAAK,aAAa,CAAC;QACnB,KAAK,aAAa,CAAC;QACnB,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY,CAAC;QAClB,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,eAAe,CAAC;QACrB,KAAK,MAAM,CAAC,CAAC,mDAAmD;QAChE,KAAK,iBAAiB,EAAE,6BAA6B;YACpD,MAAM;QACP,wCAAwC;QACxC;YACC,OAAO,CAAC,qCAAqC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1D,MAAM;IACR,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACxB,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one recipe for planning an assertion's stored violation query for
|
|
3
|
+
* analysis, shared by every caller that needs to look at the plan rather than
|
|
4
|
+
* run it: `CREATE ASSERTION`'s dependency discovery, the commit-time evaluator,
|
|
5
|
+
* and `explain_assertion()`.
|
|
6
|
+
*
|
|
7
|
+
* All three need the same three ingredients, and each one is easy to forget:
|
|
8
|
+
* the home-schema path, analysis-stage optimization, and hoist suppression.
|
|
9
|
+
*/
|
|
10
|
+
import type { Database } from '../../core/database.js';
|
|
11
|
+
import type * as AST from '../../parser/ast.js';
|
|
12
|
+
import type { PlanNode } from '../nodes/plan-node.js';
|
|
13
|
+
/**
|
|
14
|
+
* Builds and analysis-optimizes an assertion body.
|
|
15
|
+
*
|
|
16
|
+
* - Planned under `_homeSchemaPath(schemaName)` so unqualified table names in
|
|
17
|
+
* the stored body resolve against the assertion's own schema first, whatever
|
|
18
|
+
* the session's search path is.
|
|
19
|
+
* - Stopped at `optimizeForAnalysis` — the structural prefix of the pass
|
|
20
|
+
* pipeline, before physical access-path selection. Physical optimization
|
|
21
|
+
* leaves several `TableReferenceNode` instances per table, which would make
|
|
22
|
+
* any per-reference analysis over the result double-count.
|
|
23
|
+
* - Run under `withSuppressedAssertionHoist`, so another assertion's hoisted
|
|
24
|
+
* premises (or this one's own) cannot fold a base reference — or the whole
|
|
25
|
+
* violation query — out of the plan. The suppression counter is re-entrant,
|
|
26
|
+
* so a caller already inside a wider suppressed region can call this freely.
|
|
27
|
+
*
|
|
28
|
+
* `body` may be the stored SQL text or an already-parsed statement; callers
|
|
29
|
+
* that want to report a parse failure in their own words parse first and pass
|
|
30
|
+
* the AST.
|
|
31
|
+
*/
|
|
32
|
+
export declare function planAssertionBodyForAnalysis(db: Database, body: string | AST.Statement, schemaName: string): PlanNode;
|
|
33
|
+
//# sourceMappingURL=assertion-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertion-plan.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/assertion-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,4BAA4B,CAC3C,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,EAC5B,UAAU,EAAE,MAAM,GAChB,QAAQ,CAQV"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one recipe for planning an assertion's stored violation query for
|
|
3
|
+
* analysis, shared by every caller that needs to look at the plan rather than
|
|
4
|
+
* run it: `CREATE ASSERTION`'s dependency discovery, the commit-time evaluator,
|
|
5
|
+
* and `explain_assertion()`.
|
|
6
|
+
*
|
|
7
|
+
* All three need the same three ingredients, and each one is easy to forget:
|
|
8
|
+
* the home-schema path, analysis-stage optimization, and hoist suppression.
|
|
9
|
+
*/
|
|
10
|
+
import { Parser } from '../../parser/parser.js';
|
|
11
|
+
/**
|
|
12
|
+
* Builds and analysis-optimizes an assertion body.
|
|
13
|
+
*
|
|
14
|
+
* - Planned under `_homeSchemaPath(schemaName)` so unqualified table names in
|
|
15
|
+
* the stored body resolve against the assertion's own schema first, whatever
|
|
16
|
+
* the session's search path is.
|
|
17
|
+
* - Stopped at `optimizeForAnalysis` — the structural prefix of the pass
|
|
18
|
+
* pipeline, before physical access-path selection. Physical optimization
|
|
19
|
+
* leaves several `TableReferenceNode` instances per table, which would make
|
|
20
|
+
* any per-reference analysis over the result double-count.
|
|
21
|
+
* - Run under `withSuppressedAssertionHoist`, so another assertion's hoisted
|
|
22
|
+
* premises (or this one's own) cannot fold a base reference — or the whole
|
|
23
|
+
* violation query — out of the plan. The suppression counter is re-entrant,
|
|
24
|
+
* so a caller already inside a wider suppressed region can call this freely.
|
|
25
|
+
*
|
|
26
|
+
* `body` may be the stored SQL text or an already-parsed statement; callers
|
|
27
|
+
* that want to report a parse failure in their own words parse first and pass
|
|
28
|
+
* the AST.
|
|
29
|
+
*/
|
|
30
|
+
export function planAssertionBodyForAnalysis(db, body, schemaName) {
|
|
31
|
+
const ast = typeof body === 'string'
|
|
32
|
+
? new Parser().parse(body)
|
|
33
|
+
: body;
|
|
34
|
+
return db.schemaManager.withSuppressedAssertionHoist(() => {
|
|
35
|
+
const { plan } = db._buildPlan([ast], undefined, db._homeSchemaPath(schemaName));
|
|
36
|
+
return db.optimizer.optimizeForAnalysis(plan, db);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=assertion-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertion-plan.js","sourceRoot":"","sources":["../../../../src/planner/analysis/assertion-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,4BAA4B,CAC3C,EAAY,EACZ,IAA4B,EAC5B,UAAkB;IAElB,MAAM,GAAG,GAAG,OAAO,IAAI,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAkB;QAC3C,CAAC,CAAC,IAAI,CAAC;IACR,OAAO,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,GAAG,EAAE;QACzD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;QACjF,OAAO,EAAE,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single operator vocabulary for `AST.BinaryExpr` / `BinaryOpNode`.
|
|
3
|
+
*
|
|
4
|
+
* Consumers used to each restate which operator spellings they recognize, and drifted. They
|
|
5
|
+
* now all dispatch on {@link classifyBinaryOperator}:
|
|
6
|
+
* - `BinaryOpNode.generateType` (planner/nodes/scalar.ts) — the announced result type,
|
|
7
|
+
* - `buildBinaryOpSpec` (runtime/emit/binary.ts) — the evaluator body,
|
|
8
|
+
* - {@link isComparisonOperator} (analysis/comparison-collation.ts) — collation validation,
|
|
9
|
+
* - `needsComparisonCoercion` (building/expression.ts) — cross-type coercion insertion,
|
|
10
|
+
* - `isScalarComparisonOperator` (analysis/scalar-param-usage.ts) — the object-valued
|
|
11
|
+
* parameter guard.
|
|
12
|
+
*
|
|
13
|
+
* So a newly added operator is either classified for everyone or unknown to everyone — it
|
|
14
|
+
* cannot be evaluated as a comparison while being announced as its left operand's type
|
|
15
|
+
* (which is exactly what `==`, `XOR` and `LIKE` did).
|
|
16
|
+
*
|
|
17
|
+
* Operator spellings are matched case-insensitively. That matters: the parser emits keyword
|
|
18
|
+
* operators uppercased, but internally synthesized ASTs do not always
|
|
19
|
+
* (`util/mutation-statement.ts` builds `operator: 'and'`), and a case-sensitive `switch`
|
|
20
|
+
* silently misclassified those.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* How a binary operator behaves — the classification both the type announcement and the
|
|
24
|
+
* runtime body key off.
|
|
25
|
+
*
|
|
26
|
+
* `is` and `in` are classified even though `buildBinaryOpSpec` has no body for them: the
|
|
27
|
+
* planner still has to announce their result type, and `IN` in particular reaches the
|
|
28
|
+
* planner as its own `InNode` rather than a `BinaryOpNode`. Classifying them keeps the
|
|
29
|
+
* vocabulary complete rather than leaving them to fall into "unknown".
|
|
30
|
+
*/
|
|
31
|
+
export type BinaryOperatorClass =
|
|
32
|
+
/** `+ - * / %` — result type from the temporal operation table, numeric promotion, or ANY. */
|
|
33
|
+
'arithmetic'
|
|
34
|
+
/** `= == != <> < <= > >=` — BOOLEAN, and the class that resolves one collation across both operands. */
|
|
35
|
+
| 'comparison'
|
|
36
|
+
/** `IS` / `IS NOT` — null-safe comparison: BOOLEAN and never NULL. */
|
|
37
|
+
| 'is'
|
|
38
|
+
/** `IN` — BOOLEAN membership test. */
|
|
39
|
+
| 'in'
|
|
40
|
+
/** `AND OR XOR` — three-valued logic over SQL truthiness; BOOLEAN. */
|
|
41
|
+
| 'logical'
|
|
42
|
+
/** `||` — TEXT concatenation. */
|
|
43
|
+
| 'concat'
|
|
44
|
+
/** `LIKE` — BOOLEAN pattern match. */
|
|
45
|
+
| 'like';
|
|
46
|
+
/**
|
|
47
|
+
* The class of `operator`, or `undefined` for a spelling no consumer implements.
|
|
48
|
+
* Case-insensitive.
|
|
49
|
+
*
|
|
50
|
+
* Callers must handle `undefined` explicitly rather than assuming a default: the planner
|
|
51
|
+
* announces ANY (it cannot describe values it cannot produce) and the emitter raises
|
|
52
|
+
* `UNSUPPORTED`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function classifyBinaryOperator(operator: string): BinaryOperatorClass | undefined;
|
|
55
|
+
//# sourceMappingURL=binary-operator-class.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-operator-class.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/binary-operator-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB;AAC9B,8FAA8F;AAC5F,YAAY;AACd,wGAAwG;GACtG,YAAY;AACd,sEAAsE;GACpE,IAAI;AACN,sCAAsC;GACpC,IAAI;AACN,sEAAsE;GACpE,SAAS;AACX,iCAAiC;GAC/B,QAAQ;AACV,sCAAsC;GACpC,MAAM,CAAC;AA2BV;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAExF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single operator vocabulary for `AST.BinaryExpr` / `BinaryOpNode`.
|
|
3
|
+
*
|
|
4
|
+
* Consumers used to each restate which operator spellings they recognize, and drifted. They
|
|
5
|
+
* now all dispatch on {@link classifyBinaryOperator}:
|
|
6
|
+
* - `BinaryOpNode.generateType` (planner/nodes/scalar.ts) — the announced result type,
|
|
7
|
+
* - `buildBinaryOpSpec` (runtime/emit/binary.ts) — the evaluator body,
|
|
8
|
+
* - {@link isComparisonOperator} (analysis/comparison-collation.ts) — collation validation,
|
|
9
|
+
* - `needsComparisonCoercion` (building/expression.ts) — cross-type coercion insertion,
|
|
10
|
+
* - `isScalarComparisonOperator` (analysis/scalar-param-usage.ts) — the object-valued
|
|
11
|
+
* parameter guard.
|
|
12
|
+
*
|
|
13
|
+
* So a newly added operator is either classified for everyone or unknown to everyone — it
|
|
14
|
+
* cannot be evaluated as a comparison while being announced as its left operand's type
|
|
15
|
+
* (which is exactly what `==`, `XOR` and `LIKE` did).
|
|
16
|
+
*
|
|
17
|
+
* Operator spellings are matched case-insensitively. That matters: the parser emits keyword
|
|
18
|
+
* operators uppercased, but internally synthesized ASTs do not always
|
|
19
|
+
* (`util/mutation-statement.ts` builds `operator: 'and'`), and a case-sensitive `switch`
|
|
20
|
+
* silently misclassified those.
|
|
21
|
+
*/
|
|
22
|
+
const CLASS_BY_OPERATOR = new Map([
|
|
23
|
+
['+', 'arithmetic'],
|
|
24
|
+
['-', 'arithmetic'],
|
|
25
|
+
['*', 'arithmetic'],
|
|
26
|
+
['/', 'arithmetic'],
|
|
27
|
+
['%', 'arithmetic'],
|
|
28
|
+
['=', 'comparison'],
|
|
29
|
+
['==', 'comparison'],
|
|
30
|
+
['!=', 'comparison'],
|
|
31
|
+
['<>', 'comparison'],
|
|
32
|
+
['<', 'comparison'],
|
|
33
|
+
['<=', 'comparison'],
|
|
34
|
+
['>', 'comparison'],
|
|
35
|
+
['>=', 'comparison'],
|
|
36
|
+
['IS', 'is'],
|
|
37
|
+
['IS NOT', 'is'],
|
|
38
|
+
['IN', 'in'],
|
|
39
|
+
['AND', 'logical'],
|
|
40
|
+
['OR', 'logical'],
|
|
41
|
+
['XOR', 'logical'],
|
|
42
|
+
['||', 'concat'],
|
|
43
|
+
['LIKE', 'like'],
|
|
44
|
+
// TODO: bitwise operators (& | << >> ) — the parser does not produce them yet.
|
|
45
|
+
]);
|
|
46
|
+
/**
|
|
47
|
+
* The class of `operator`, or `undefined` for a spelling no consumer implements.
|
|
48
|
+
* Case-insensitive.
|
|
49
|
+
*
|
|
50
|
+
* Callers must handle `undefined` explicitly rather than assuming a default: the planner
|
|
51
|
+
* announces ANY (it cannot describe values it cannot produce) and the emitter raises
|
|
52
|
+
* `UNSUPPORTED`.
|
|
53
|
+
*/
|
|
54
|
+
export function classifyBinaryOperator(operator) {
|
|
55
|
+
return CLASS_BY_OPERATOR.get(operator.toUpperCase());
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=binary-operator-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-operator-class.js","sourceRoot":"","sources":["../../../../src/planner/analysis/binary-operator-class.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA2BH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAA8B;IAC9D,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,IAAI,EAAE,YAAY,CAAC;IACpB,CAAC,IAAI,EAAE,YAAY,CAAC;IACpB,CAAC,IAAI,EAAE,YAAY,CAAC;IACpB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,IAAI,EAAE,YAAY,CAAC;IACpB,CAAC,GAAG,EAAE,YAAY,CAAC;IACnB,CAAC,IAAI,EAAE,YAAY,CAAC;IACpB,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAChB,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,KAAK,EAAE,SAAS,CAAC;IAClB,CAAC,IAAI,EAAE,SAAS,CAAC;IACjB,CAAC,KAAK,EAAE,SAAS,CAAC;IAClB,CAAC,IAAI,EAAE,QAAQ,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,+EAA+E;CAC/E,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACtD,OAAO,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
* `analyzeRowSpecific.groupKeys`.
|
|
14
14
|
* - 'global' bindings carry no extra metadata — the consumer evaluates its
|
|
15
15
|
* plan once for any dependency change.
|
|
16
|
+
*
|
|
17
|
+
* The plan walk `extractBindings` is built on — {@link collectTableReferences} —
|
|
18
|
+
* and the relation-key spelling both live in `relation-key.ts`, so every consumer
|
|
19
|
+
* asking "which base tables does this plan read" gets the same answer keyed the
|
|
20
|
+
* same way.
|
|
16
21
|
*/
|
|
17
|
-
import { PlanNode,
|
|
22
|
+
import type { PlanNode, RelationalPlanNode } from '../nodes/plan-node.js';
|
|
23
|
+
import { type RelationKey } from './relation-key.js';
|
|
18
24
|
/**
|
|
19
25
|
* The way one plan instance binds to its changes.
|
|
20
26
|
*
|
|
@@ -40,9 +46,9 @@ export type BindingMode = {
|
|
|
40
46
|
*/
|
|
41
47
|
export interface PlanBindings {
|
|
42
48
|
/** For each TableReference instance in the plan, how this plan is bound to its changes. */
|
|
43
|
-
perRelation: Map<
|
|
49
|
+
perRelation: Map<RelationKey, BindingMode>;
|
|
44
50
|
/** Convenience: relationKey → base table name (lowercased `schema.table`). */
|
|
45
|
-
relationToBase: Map<
|
|
51
|
+
relationToBase: Map<RelationKey, string>;
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
48
54
|
* Walk a plan and emit the per-`TableReferenceNode` binding modes the runtime
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-extractor.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/binding-extractor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"binding-extractor.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/binding-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,2FAA2F;IAC3F,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC3C,8EAA8E;IAC9E,cAAc,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,kBAAkB,GAAG,YAAY,CAmDjF"}
|
|
@@ -13,9 +13,14 @@
|
|
|
13
13
|
* `analyzeRowSpecific.groupKeys`.
|
|
14
14
|
* - 'global' bindings carry no extra metadata — the consumer evaluates its
|
|
15
15
|
* plan once for any dependency change.
|
|
16
|
+
*
|
|
17
|
+
* The plan walk `extractBindings` is built on — {@link collectTableReferences} —
|
|
18
|
+
* and the relation-key spelling both live in `relation-key.ts`, so every consumer
|
|
19
|
+
* asking "which base tables does this plan read" gets the same answer keyed the
|
|
20
|
+
* same way.
|
|
16
21
|
*/
|
|
17
|
-
import { TableReferenceNode } from '../nodes/reference.js';
|
|
18
22
|
import { analyzeRowSpecific, extractCoveredKeysForTable } from './constraint-extractor.js';
|
|
23
|
+
import { collectTableReferences } from './relation-key.js';
|
|
19
24
|
/**
|
|
20
25
|
* Walk a plan and emit the per-`TableReferenceNode` binding modes the runtime
|
|
21
26
|
* needs to parameterize a delta-driven consumer over the same plan.
|
|
@@ -30,8 +35,10 @@ export function extractBindings(plan) {
|
|
|
30
35
|
const { classifications, groupKeys } = analyzeRowSpecific(plan);
|
|
31
36
|
const perRelation = new Map();
|
|
32
37
|
const relationToBase = new Map();
|
|
33
|
-
const
|
|
34
|
-
|
|
38
|
+
const tableRefs = collectTableReferences(plan);
|
|
39
|
+
for (const [relKey, ref] of tableRefs) {
|
|
40
|
+
relationToBase.set(relKey, ref.base);
|
|
41
|
+
}
|
|
35
42
|
for (const [relKey, classification] of classifications) {
|
|
36
43
|
if (classification === 'global') {
|
|
37
44
|
perRelation.set(relKey, { kind: 'global' });
|
|
@@ -52,7 +59,7 @@ export function extractBindings(plan) {
|
|
|
52
59
|
}
|
|
53
60
|
// 'row': pick the same key the assertion path picks today: PK first,
|
|
54
61
|
// else first covered unique key.
|
|
55
|
-
const tableRef =
|
|
62
|
+
const tableRef = tableRefs.get(relKey)?.node;
|
|
56
63
|
if (!tableRef) {
|
|
57
64
|
perRelation.set(relKey, { kind: 'global' });
|
|
58
65
|
continue;
|
|
@@ -98,16 +105,4 @@ function chooseRowKey(pkIndices, coveredKeys) {
|
|
|
98
105
|
});
|
|
99
106
|
return sorted[0];
|
|
100
107
|
}
|
|
101
|
-
function collectTableRefs(node, out, relationToBase) {
|
|
102
|
-
if (node instanceof TableReferenceNode) {
|
|
103
|
-
const schema = node.tableSchema;
|
|
104
|
-
const base = `${schema.schemaName}.${schema.name}`.toLowerCase();
|
|
105
|
-
const relKey = `${base}#${node.id ?? 'unknown'}`;
|
|
106
|
-
out.set(relKey, node);
|
|
107
|
-
relationToBase.set(relKey, base);
|
|
108
|
-
}
|
|
109
|
-
for (const child of node.getChildren()) {
|
|
110
|
-
collectTableRefs(child, out, relationToBase);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
108
|
//# sourceMappingURL=binding-extractor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-extractor.js","sourceRoot":"","sources":["../../../../src/planner/analysis/binding-extractor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"binding-extractor.js","sourceRoot":"","sources":["../../../../src/planner/analysis/binding-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAoB,MAAM,mBAAmB,CAAC;AA4B7E;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAmC;IAClE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAEhE,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEjD,MAAM,SAAS,GAAG,sBAAsB,CAAC,IAAgB,CAAC,CAAC;IAC3D,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,SAAS,EAAE,CAAC;QACvC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,eAAe,EAAE,CAAC;QACxD,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;YACjC,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC5C,SAAS;QACV,CAAC;QACD,IAAI,cAAc,KAAK,OAAO,EAAE,CAAC;YAChC,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,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CAAC;gBAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-scope.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/change-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,QAAQ,EAAsC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"change-scope.d.ts","sourceRoot":"","sources":["../../../../src/planner/analysis/change-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,QAAQ,EAAsC,MAAM,uBAAuB,CAAC;AAY1F,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED,0GAA0G;AAC1G,MAAM,MAAM,YAAY,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CA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CAAE,GACf;IAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAEjD,UAAU,oBAAoB;IAC7B,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC1B,KAAK,EAAE,oBAAoB,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,uBAAuB,EAAE,YAAY,EAAE,CAAC;IACxC,iBAAiB,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CAClD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,qBAAqB,CAU9E;AA0BD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,qBAAqB,GAAG,WAAW,CAU9E"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isRelationalNode } from '../nodes/plan-node.js';
|
|
2
2
|
import { TableReferenceNode, ColumnReferenceNode, ParameterReferenceNode } from '../nodes/reference.js';
|
|
3
3
|
import { ScalarFunctionCallNode } from '../nodes/function.js';
|
|
4
|
+
import { SequenceNode } from '../nodes/sequence-node.js';
|
|
4
5
|
import { PlanNodeType } from '../nodes/plan-node-type.js';
|
|
5
6
|
import { FunctionFlags } from '../../common/constants.js';
|
|
6
7
|
import { extractBindings } from './binding-extractor.js';
|
|
8
|
+
import { relationKeyOf } from './relation-key.js';
|
|
7
9
|
import { extractConstraintsForTable } from './constraint-extractor.js';
|
|
8
10
|
import { compareSqlValues } from '../../util/comparison.js';
|
|
9
11
|
import { getTypeOrDefault } from '../../types/registry.js';
|
|
@@ -81,7 +83,7 @@ export function analyzeChangeScope(plan, options) {
|
|
|
81
83
|
const mvSourceScopes = [];
|
|
82
84
|
if (!dmlWithoutReturning) {
|
|
83
85
|
for (const ref of tableRefs) {
|
|
84
|
-
const relKey =
|
|
86
|
+
const relKey = relationKeyOf(ref);
|
|
85
87
|
const mode = perRelation.get(relKey);
|
|
86
88
|
if (!mode)
|
|
87
89
|
continue;
|
|
@@ -123,6 +125,14 @@ export function analyzeChangeScope(plan, options) {
|
|
|
123
125
|
* parameters in the WHERE/SET clauses still count toward unboundParameters).
|
|
124
126
|
*/
|
|
125
127
|
function isDmlWithoutReturning(plan) {
|
|
128
|
+
// A Sequence node prepends side-effect statements (sunk unreferenced
|
|
129
|
+
// data-modifying CTEs) ahead of the actual statement. Classify by the MAIN
|
|
130
|
+
// child only: the effects' RETURNING clauses are internal to the sunk CTE
|
|
131
|
+
// bodies, not the statement's own RETURNING, and the effects give the node
|
|
132
|
+
// 2+ children so the single-child descent below would stop short.
|
|
133
|
+
if (plan instanceof SequenceNode) {
|
|
134
|
+
return isDmlWithoutReturning(plan.main);
|
|
135
|
+
}
|
|
126
136
|
function hasReturning(node) {
|
|
127
137
|
if (node.nodeType === PlanNodeType.Returning)
|
|
128
138
|
return true;
|
|
@@ -154,10 +164,13 @@ function isDmlWithoutReturning(plan) {
|
|
|
154
164
|
return !hasReturning(plan);
|
|
155
165
|
}
|
|
156
166
|
/* --- Plan walking helpers ------------------------------------------------ */
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Deliberately NOT `relation-key.ts`'s `collectTableReferences`: this walk also
|
|
169
|
+
* follows `getRelations()` (see the DML write-target note in the body) and carries a
|
|
170
|
+
* cycle guard. Only the walk differs — the keys it is compared against come from
|
|
171
|
+
* `extractBindings`, so the relation-key *label* must stay the shared one
|
|
172
|
+
* (`relationKeyOf`).
|
|
173
|
+
*/
|
|
161
174
|
function collectTableRefs(plan) {
|
|
162
175
|
const out = [];
|
|
163
176
|
const seen = new Set();
|
|
@@ -197,7 +210,7 @@ function collectColumnReads(plan, tableRefs) {
|
|
|
197
210
|
const attrToRelKeyAndIdx = new Map();
|
|
198
211
|
const refByRelKey = new Map();
|
|
199
212
|
for (const ref of tableRefs) {
|
|
200
|
-
const relKey =
|
|
213
|
+
const relKey = relationKeyOf(ref);
|
|
201
214
|
refByRelKey.set(relKey, ref);
|
|
202
215
|
const attrs = ref.getAttributes();
|
|
203
216
|
attrs.forEach((a, i) => attrToRelKeyAndIdx.set(a.id, { relKey, colIdx: i }));
|