@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign-key-builder.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/foreign-key-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,0BAA0B,EAAuB,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"foreign-key-builder.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/foreign-key-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,SAAS,EAAE,EAC1B,aAAa,EAAE,SAAS,EAAE,EAC1B,iBAAiB,GAAE,aAAa,CAAC,wBAAwB,CAAM,GAC7D,eAAe,EAAE,CAoHnB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,EAAE,EAAE,0BAA0B,CAAC;IACxC,wFAAwF;IACxF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,uBAAuB,CACtC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,UAAU,EAAE,kBAAkB,GAAG,SAAS,EAC1C,UAAU,EAAE,OAAO,GACjB,mBAAmB,EAAE,GAAG,SAAS,CAwBnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RowOpFlag,
|
|
1
|
+
import { RowOpFlag, resolveReferencedColumnsForEnforcement } from '../../schema/table.js';
|
|
2
2
|
import { ConflictResolution } from '../../common/constants.js';
|
|
3
3
|
import { RegisteredScope } from '../scopes/registered.js';
|
|
4
4
|
import { buildExpression } from './expression.js';
|
|
@@ -151,28 +151,37 @@ export function buildChildSideFKChecks(ctx, tableSchema, operation, oldAttribute
|
|
|
151
151
|
// FK column is NULL — but otherwise no parent row can match, so the check must
|
|
152
152
|
// fail. Build a null-guard chain terminated by a falsy literal in that case.
|
|
153
153
|
const parentSchema = ctx.schemaManager.findTable(fk.referencedTable, fk.referencedSchema);
|
|
154
|
+
const constraintName = fk.name ?? `_fk_${tableSchema.name}`;
|
|
154
155
|
let existsExpr;
|
|
156
|
+
// Set only for the absent-parent fallback: the null-guard chain is engine-
|
|
157
|
+
// synthesized, so quoting it back as the failure hint tells the user nothing
|
|
158
|
+
// about WHY the row was rejected. Name the table that is missing instead.
|
|
159
|
+
let violationMessage;
|
|
155
160
|
if (!parentSchema) {
|
|
156
|
-
|
|
161
|
+
const parentQualified = `${fk.referencedSchema ?? tableSchema.schemaName}.${fk.referencedTable}`;
|
|
162
|
+
log(`FK '${fk.name}': parent table '${parentQualified}' not found; emitting null-guards-only check`);
|
|
157
163
|
const nullGuards = fk.columns.map((childColIdx) => ({
|
|
158
164
|
type: 'unary',
|
|
159
165
|
operator: 'IS NULL',
|
|
160
166
|
expr: { type: 'column', name: tableSchema.columns[childColIdx].name, table: 'NEW' },
|
|
161
167
|
}));
|
|
162
168
|
existsExpr = nullGuards.reduceRight((acc, guard) => ({ type: 'binary', operator: 'OR', left: guard, right: acc }), { type: 'literal', value: 0 });
|
|
169
|
+
// An unqualified parent name binds to the CHILD's own schema
|
|
170
|
+
// (docs/sql-constraints.md §7.6), so naming the schema is what makes a cross-schema mistake
|
|
171
|
+
// visible: the fix is to qualify the parent.
|
|
172
|
+
violationMessage = `CHECK constraint failed: ${constraintName} — referenced table `
|
|
173
|
+
+ `'${parentQualified}' does not exist`;
|
|
163
174
|
}
|
|
164
175
|
else {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
176
|
+
// A count mismatch means the FK cannot be checked at all — raise rather
|
|
177
|
+
// than skip, so an unenforceable constraint never looks enforced.
|
|
178
|
+
const parentColIndices = resolveReferencedColumnsForEnforcement(fk, parentSchema, tableSchema);
|
|
170
179
|
// Synthesize EXISTS(SELECT 1 FROM parent WHERE parent.ref = NEW.fk)
|
|
171
180
|
existsExpr = synthesizeExistsCheck(fk, tableSchema, parentSchema, parentColIndices, 'new');
|
|
172
181
|
}
|
|
173
182
|
// Build as a RowConstraintSchema so it integrates with existing infrastructure
|
|
174
183
|
const syntheticConstraint = {
|
|
175
|
-
name:
|
|
184
|
+
name: constraintName,
|
|
176
185
|
expr: existsExpr,
|
|
177
186
|
operations: (RowOpFlag.INSERT | RowOpFlag.UPDATE),
|
|
178
187
|
deferrable: true,
|
|
@@ -218,6 +227,7 @@ export function buildChildSideFKChecks(ctx, tableSchema, operation, oldAttribute
|
|
|
218
227
|
initiallyDeferred: true,
|
|
219
228
|
needsDeferred: true,
|
|
220
229
|
kind: 'fk-child',
|
|
230
|
+
violationMessage,
|
|
221
231
|
});
|
|
222
232
|
}
|
|
223
233
|
finally {
|
|
@@ -257,9 +267,9 @@ export function buildParentSideFKChecks(ctx, tableSchema, operation, oldAttribut
|
|
|
257
267
|
// rejected by the immediate plan-time NOT EXISTS).
|
|
258
268
|
if (suppressed.has(fk))
|
|
259
269
|
continue;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
270
|
+
// A count mismatch means this inbound FK cannot be checked — raise rather
|
|
271
|
+
// than skip, so RESTRICT never silently stops rejecting.
|
|
272
|
+
const parentColIndices = resolveReferencedColumnsForEnforcement(fk, tableSchema, childTable);
|
|
263
273
|
// For UPDATE, the runtime skips this check when none of `parentColIndices`
|
|
264
274
|
// changed (see runtime/row-constraints.ts).
|
|
265
275
|
// Synthesize NOT EXISTS(SELECT 1 FROM child WHERE child.fk = OLD.pk)
|
|
@@ -346,12 +356,24 @@ export function buildParentSideFKChecks(ctx, tableSchema, operation, oldAttribut
|
|
|
346
356
|
* outcome depends on which rows the same statement has already deleted.
|
|
347
357
|
*
|
|
348
358
|
* An inbound FK whose referenced-column resolution is malformed (column-count
|
|
349
|
-
* mismatch)
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
359
|
+
* mismatch) RAISES here, matching the per-row builders — the batch replaces
|
|
360
|
+
* both per-row probes, so skipping it would leave the FK unenforced on this
|
|
361
|
+
* route only. That raise is why the `foreign_keys` pragma is checked HERE rather
|
|
362
|
+
* than left to callers: with enforcement off nothing is checked on either route,
|
|
363
|
+
* so a malformed inbound FK must not fail the statement either. Taking `db`
|
|
364
|
+
* (not a bare `SchemaManager`) is what makes that unforgettable — the runtime
|
|
365
|
+
* DML executor calls this gate on every DELETE/UPDATE and has no other pragma
|
|
366
|
+
* check before it.
|
|
367
|
+
*
|
|
368
|
+
* NOTE: the trust-the-origin RESTRICT suppression (`db._isFkRestrictSuppressed()`,
|
|
369
|
+
* re-checked in `flushParentRestrictBatch`) is deliberately NOT part of the gate —
|
|
370
|
+
* suppression means the origin already enforced this FK, and a malformed FK is a
|
|
371
|
+
* malformed declaration on both ends. If an apply-path write ever needs to survive
|
|
372
|
+
* a receiver-only malformed FK, this is the site to widen.
|
|
353
373
|
*/
|
|
354
|
-
export function getBatchableRestrictFks(
|
|
374
|
+
export function getBatchableRestrictFks(db, tableSchema, operation, onConflict, lensRouted) {
|
|
375
|
+
if (!db.options.getBooleanOption('foreign_keys'))
|
|
376
|
+
return undefined;
|
|
355
377
|
if (lensRouted)
|
|
356
378
|
return undefined;
|
|
357
379
|
if (onConflict !== undefined
|
|
@@ -360,7 +382,7 @@ export function getBatchableRestrictFks(schemaManager, tableSchema, operation, o
|
|
|
360
382
|
return undefined;
|
|
361
383
|
}
|
|
362
384
|
const batchable = [];
|
|
363
|
-
for (const { childTable, fk } of schemaManager.getReferencingForeignKeys(tableSchema.schemaName, tableSchema.name)) {
|
|
385
|
+
for (const { childTable, fk } of db.schemaManager.getReferencingForeignKeys(tableSchema.schemaName, tableSchema.name)) {
|
|
364
386
|
const action = operation === 'delete' ? fk.onDelete : fk.onUpdate;
|
|
365
387
|
if (action !== 'restrict')
|
|
366
388
|
return undefined;
|
|
@@ -368,9 +390,10 @@ export function getBatchableRestrictFks(schemaManager, tableSchema, operation, o
|
|
|
368
390
|
&& childTable.name.toLowerCase() === tableSchema.name.toLowerCase()) {
|
|
369
391
|
return undefined;
|
|
370
392
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
393
|
+
// Raises on a column-count mismatch, exactly as the per-row builders do —
|
|
394
|
+
// the batch is the ONLY enforcement on this route (the per-row parent-side
|
|
395
|
+
// checks are not built when batching applies), so it must not skip.
|
|
396
|
+
const parentColIndices = resolveReferencedColumnsForEnforcement(fk, tableSchema, childTable);
|
|
374
397
|
batchable.push({ childTable, fk, parentColIndices });
|
|
375
398
|
}
|
|
376
399
|
return batchable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foreign-key-builder.js","sourceRoot":"","sources":["../../../../src/planner/building/foreign-key-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAkB,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,mCAAmC,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,8BAA8B,EAAiC,MAAM,uBAAuB,CAAC;AAE/H,MAAM,GAAG,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAE/C;;;;;;;GAOG;AACH,SAAS,oBAAoB,CAC5B,aAAqB,EACrB,WAAgG,EAChG,UAAmB;IAEnB,MAAM,UAAU,GAAqB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACvG,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,GAAG;QACb,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,O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TableSchema } from '../../schema/table.js';
|
|
4
|
+
import type { Attribute, ScalarPlanNode } from '../nodes/plan-node.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compile one `generated always as (<expr>)` body against the row it is computed
|
|
7
|
+
* from. THE one place that decides what a generated expression may name, so the
|
|
8
|
+
* four sites that compile such a body — the INSERT row expansion, the
|
|
9
|
+
* `on conflict do update` recompute, the UPDATE recompute, and the
|
|
10
|
+
* `alter table … add column` backfill — accept exactly the same spellings. A
|
|
11
|
+
* declaration `create table` (or `alter table`) accepts is therefore one every
|
|
12
|
+
* subsequent write accepts.
|
|
13
|
+
*
|
|
14
|
+
* Accepted spellings, matching what the schema-time reference analysis
|
|
15
|
+
* (`schema/generated-column-refs.ts`) already classifies as binding the owning
|
|
16
|
+
* table's row:
|
|
17
|
+
*
|
|
18
|
+
* | spelling | how it resolves |
|
|
19
|
+
* |---------------------------------|--------------------------------------------------|
|
|
20
|
+
* | `<col>` | registered below |
|
|
21
|
+
* | `<table>.<col>` | folded to `<col>` by the self-qualifier strip |
|
|
22
|
+
* | `<own-schema>.<table>.<col>` | same |
|
|
23
|
+
* | `new.<col>` | registered below — an exact alias for the bare form|
|
|
24
|
+
* | `old.<col>` | NOT registered: a generated value is computed from |
|
|
25
|
+
* | | the row being written; there is no old row |
|
|
26
|
+
* | any other qualifier | falls through to the ordinary scope chain |
|
|
27
|
+
*
|
|
28
|
+
* `new.<col>` is accepted rather than rejected because `alter table … add column`
|
|
29
|
+
* already accepts and correctly backfills it, and because both `CHECK`
|
|
30
|
+
* (`constraint-builder.ts`) and column `DEFAULT` (`default-scope.ts`) accept it —
|
|
31
|
+
* for a `DEFAULT` it is the ONLY accepted spelling.
|
|
32
|
+
*
|
|
33
|
+
* MUTATION CONTEXT: unlike a `CHECK` or a column `DEFAULT`, a `with context`
|
|
34
|
+
* variable does NOT shadow a same-named column here — the bare name always means
|
|
35
|
+
* the column, and context variables are not registered at all. Two reasons: a
|
|
36
|
+
* generated value is a pure function of the row being written and must compute
|
|
37
|
+
* identically at every one of the four sites, and the `alter table … add column`
|
|
38
|
+
* backfill has no mutation-context envelope to read (letting a context variable
|
|
39
|
+
* capture the name would make a currently-working backfill fail); and the
|
|
40
|
+
* schema-time analysis already rejects any bare name in a generated body that is
|
|
41
|
+
* not a column of the table, so a generated body can only ever *collide* with a
|
|
42
|
+
* context variable, never usefully name one. See docs/sql-ddl.md § Generated
|
|
43
|
+
* Columns.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildGeneratedColumnExpr(ctx: PlanningContext, tableSchema: TableSchema,
|
|
46
|
+
/** The generated column's name, for the determinism diagnostic. At
|
|
47
|
+
* `add column` this is the column being declared, which is NOT yet in
|
|
48
|
+
* `tableSchema.columns`. */
|
|
49
|
+
columnName: string, generatedExpr: AST.Expression,
|
|
50
|
+
/**
|
|
51
|
+
* The attributes carrying the row the expression computes from, index-aligned
|
|
52
|
+
* with `tableSchema.columns`. Each site supplies its own: the prior projection's
|
|
53
|
+
* output (INSERT, so a generated column referencing another sees the freshly
|
|
54
|
+
* computed value), the conflicting row (`do update`), the update source, or the
|
|
55
|
+
* pre-ALTER row (backfill).
|
|
56
|
+
*/
|
|
57
|
+
rowAttributes: ReadonlyArray<Attribute>): ScalarPlanNode;
|
|
58
|
+
//# sourceMappingURL=generated-column-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-column-scope.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/generated-column-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAGhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAYvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,eAAe,EACpB,WAAW,EAAE,WAAW;AACxB;;6BAE6B;AAC7B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,GAAG,CAAC,UAAU;AAC7B;;;;;;GAMG;AACH,aAAa,EAAE,aAAa,CAAC,SAAS,CAAC,GACrC,cAAc,CAgEhB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { quereusError } from '../../common/errors.js';
|
|
2
|
+
import { StatusCode } from '../../common/types.js';
|
|
3
|
+
import { RegisteredScope } from '../scopes/registered.js';
|
|
4
|
+
import { ColumnReferenceNode } from '../nodes/reference.js';
|
|
5
|
+
import { buildExpression } from './expression.js';
|
|
6
|
+
import { schemaAuthoredContext } from './schema-authored-context.js';
|
|
7
|
+
import { validateDeterministicGenerated } from '../validation/determinism-validator.js';
|
|
8
|
+
import { stripSelfQualifierInSchemaExpression } from '../../schema/rename-rewriter.js';
|
|
9
|
+
import { buildColumnSourceResolver } from '../../schema/column-source-resolver.js';
|
|
10
|
+
import { cloneExpr } from '../mutation/scope-transform.js';
|
|
11
|
+
import { columnSchemaToScalarType } from '../type-utils.js';
|
|
12
|
+
/**
|
|
13
|
+
* Compile one `generated always as (<expr>)` body against the row it is computed
|
|
14
|
+
* from. THE one place that decides what a generated expression may name, so the
|
|
15
|
+
* four sites that compile such a body — the INSERT row expansion, the
|
|
16
|
+
* `on conflict do update` recompute, the UPDATE recompute, and the
|
|
17
|
+
* `alter table … add column` backfill — accept exactly the same spellings. A
|
|
18
|
+
* declaration `create table` (or `alter table`) accepts is therefore one every
|
|
19
|
+
* subsequent write accepts.
|
|
20
|
+
*
|
|
21
|
+
* Accepted spellings, matching what the schema-time reference analysis
|
|
22
|
+
* (`schema/generated-column-refs.ts`) already classifies as binding the owning
|
|
23
|
+
* table's row:
|
|
24
|
+
*
|
|
25
|
+
* | spelling | how it resolves |
|
|
26
|
+
* |---------------------------------|--------------------------------------------------|
|
|
27
|
+
* | `<col>` | registered below |
|
|
28
|
+
* | `<table>.<col>` | folded to `<col>` by the self-qualifier strip |
|
|
29
|
+
* | `<own-schema>.<table>.<col>` | same |
|
|
30
|
+
* | `new.<col>` | registered below — an exact alias for the bare form|
|
|
31
|
+
* | `old.<col>` | NOT registered: a generated value is computed from |
|
|
32
|
+
* | | the row being written; there is no old row |
|
|
33
|
+
* | any other qualifier | falls through to the ordinary scope chain |
|
|
34
|
+
*
|
|
35
|
+
* `new.<col>` is accepted rather than rejected because `alter table … add column`
|
|
36
|
+
* already accepts and correctly backfills it, and because both `CHECK`
|
|
37
|
+
* (`constraint-builder.ts`) and column `DEFAULT` (`default-scope.ts`) accept it —
|
|
38
|
+
* for a `DEFAULT` it is the ONLY accepted spelling.
|
|
39
|
+
*
|
|
40
|
+
* MUTATION CONTEXT: unlike a `CHECK` or a column `DEFAULT`, a `with context`
|
|
41
|
+
* variable does NOT shadow a same-named column here — the bare name always means
|
|
42
|
+
* the column, and context variables are not registered at all. Two reasons: a
|
|
43
|
+
* generated value is a pure function of the row being written and must compute
|
|
44
|
+
* identically at every one of the four sites, and the `alter table … add column`
|
|
45
|
+
* backfill has no mutation-context envelope to read (letting a context variable
|
|
46
|
+
* capture the name would make a currently-working backfill fail); and the
|
|
47
|
+
* schema-time analysis already rejects any bare name in a generated body that is
|
|
48
|
+
* not a column of the table, so a generated body can only ever *collide* with a
|
|
49
|
+
* context variable, never usefully name one. See docs/sql-ddl.md § Generated
|
|
50
|
+
* Columns.
|
|
51
|
+
*/
|
|
52
|
+
export function buildGeneratedColumnExpr(ctx, tableSchema,
|
|
53
|
+
/** The generated column's name, for the determinism diagnostic. At
|
|
54
|
+
* `add column` this is the column being declared, which is NOT yet in
|
|
55
|
+
* `tableSchema.columns`. */
|
|
56
|
+
columnName, generatedExpr,
|
|
57
|
+
/**
|
|
58
|
+
* The attributes carrying the row the expression computes from, index-aligned
|
|
59
|
+
* with `tableSchema.columns`. Each site supplies its own: the prior projection's
|
|
60
|
+
* output (INSERT, so a generated column referencing another sees the freshly
|
|
61
|
+
* computed value), the conflicting row (`do update`), the update source, or the
|
|
62
|
+
* pre-ALTER row (backfill).
|
|
63
|
+
*/
|
|
64
|
+
rowAttributes) {
|
|
65
|
+
// Fold `<table>.<col>` / `<schema>.<table>.<col>` to the bare form the scope
|
|
66
|
+
// registers, on a clone — never the stored AST. Done as a rewrite rather than by
|
|
67
|
+
// seeding `<table>.<col>` scope keys for the reason `constraint-builder.ts`
|
|
68
|
+
// documents: this scope is an ancestor of every subquery planned inside the body,
|
|
69
|
+
// and qualified keys would let a join peer's parent-chain fallback resolve an
|
|
70
|
+
// inner relation's qualified columns against the outer row context.
|
|
71
|
+
//
|
|
72
|
+
// NOTE: clones and walks the body on every plan build of a write to a table with
|
|
73
|
+
// generated columns, exactly as the CHECK path does. Plan-build only (statements
|
|
74
|
+
// are prepared once, not per row) and generated bodies are small; if this ever
|
|
75
|
+
// shows up in a profile, cache the stripped form on the column schema.
|
|
76
|
+
let expr = generatedExpr;
|
|
77
|
+
const stripped = cloneExpr(generatedExpr);
|
|
78
|
+
if (stripSelfQualifierInSchemaExpression(stripped, tableSchema.name, tableSchema.schemaName, buildColumnSourceResolver(ctx.db))) {
|
|
79
|
+
expr = stripped;
|
|
80
|
+
}
|
|
81
|
+
const scope = new RegisteredScope(ctx.scope);
|
|
82
|
+
// NOTE: a column whose quoted name contains a dot (`"new.a"` beside a column `a`)
|
|
83
|
+
// makes the `new.` alias key collide with the bare key, and `registerSymbol`
|
|
84
|
+
// rejects the duplicate — so every write to such a table fails to plan. Pre-exists
|
|
85
|
+
// this builder on the CHECK (`constraint-builder.ts`) and `do update` SET scopes,
|
|
86
|
+
// which key the same flat `<qualifier>.<name>` string namespace; tracked as
|
|
87
|
+
// `bug-scope-symbol-keys-collide-with-dotted-column-names`. Do not paper over it
|
|
88
|
+
// here — a local skip would silently pick one of the two columns.
|
|
89
|
+
tableSchema.columns.forEach((column, columnIndex) => {
|
|
90
|
+
const attr = rowAttributes[columnIndex];
|
|
91
|
+
if (!attr) {
|
|
92
|
+
// Every caller derives its row from `tableSchema.columns`, so a short array
|
|
93
|
+
// is a caller bug. Failing loudly beats registering nothing: the missing
|
|
94
|
+
// column name would fall through to the enclosing scope and bind whatever
|
|
95
|
+
// happens to be there.
|
|
96
|
+
quereusError(`Internal: generated column '${columnName}' on '${tableSchema.name}' has no row attribute for column '${column.name}' (index ${columnIndex}); row supplies ${rowAttributes.length} of ${tableSchema.columns.length}`, StatusCode.INTERNAL);
|
|
97
|
+
}
|
|
98
|
+
// Resolve against the column's DECLARED type (which carries its declared
|
|
99
|
+
// collation), so a generated expression comparing text resolves the same
|
|
100
|
+
// collation a read-path query and a CHECK would — the row attribute's type
|
|
101
|
+
// reflects whatever expression produced it.
|
|
102
|
+
const columnType = columnSchemaToScalarType(column);
|
|
103
|
+
const makeRef = (exp, s) => new ColumnReferenceNode(s, exp, columnType, attr.id, columnIndex);
|
|
104
|
+
const colNameLower = column.name.toLowerCase();
|
|
105
|
+
scope.registerSymbol(colNameLower, makeRef);
|
|
106
|
+
scope.registerSymbol(`new.${colNameLower}`, makeRef);
|
|
107
|
+
});
|
|
108
|
+
// Schema-authored SQL: bare relation names inside the body resolve against the
|
|
109
|
+
// TABLE's own schema and cannot bind the writing statement's CTEs, whichever site
|
|
110
|
+
// is compiling it.
|
|
111
|
+
const node = buildExpression({ ...schemaAuthoredContext(ctx, tableSchema.schemaName), scope }, expr);
|
|
112
|
+
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
113
|
+
validateDeterministicGenerated(node, columnName, tableSchema.name);
|
|
114
|
+
}
|
|
115
|
+
return node;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=generated-column-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-column-scope.js","sourceRoot":"","sources":["../../../../src/planner/building/generated-column-scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAA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EpB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACjE,8BAA8B,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/insert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAU9D,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAA2D,MAAM,uBAAuB,CAAC;AAKnI,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../../src/planner/building/insert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAU9D,OAAO,EAAE,QAAQ,EAAE,KAAK,kBAAkB,EAA2D,MAAM,uBAAuB,CAAC;AAKnI,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD,OAAO,EAA+B,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAkjB9F,wBAAgB,eAAe,CAC9B,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,GAAG,CAAC,UAAU;AACpB;;;;;;GAMG;AACH,gBAAgB,GAAE,aAAa,CAAC,mBAAmB,CAAM;AACzD;;;;;;;;;GASG;AACH,cAAc,CAAC,EAAE,kBAAkB;AACnC;;;;;;GAMG;AACH,UAAU,UAAQ;AAClB;;;;;;;;;;;;GAYG;AACH,sBAAsB,CAAC,EAAE,KAAK,GAC5B,QAAQ,CAuaV"}
|
|
@@ -12,6 +12,7 @@ import { buildExpression } from './expression.js';
|
|
|
12
12
|
import { checkColumnsAssignable, columnSchemaToDef, columnSchemaToScalarType } from '../type-utils.js';
|
|
13
13
|
import { RegisteredScope } from '../scopes/registered.js';
|
|
14
14
|
import { buildRowDefaultScope } from './default-scope.js';
|
|
15
|
+
import { buildGeneratedColumnExpr } from './generated-column-scope.js';
|
|
15
16
|
import { ColumnReferenceNode } from '../nodes/reference.js';
|
|
16
17
|
import { SinkNode } from '../nodes/sink-node.js';
|
|
17
18
|
import { ConstraintCheckNode } from '../nodes/constraint-check-node.js';
|
|
@@ -25,7 +26,7 @@ import { DmlExecutorNode } from '../nodes/dml-executor-node.js';
|
|
|
25
26
|
import { buildConstraintChecks, buildNotNullDefaults } from './constraint-builder.js';
|
|
26
27
|
import { buildChildSideFKChecks, buildParentSideFKChecks, getBatchableRestrictFks } from './foreign-key-builder.js';
|
|
27
28
|
import { schemaAuthoredContext } from './schema-authored-context.js';
|
|
28
|
-
import { validateDeterministicDefault
|
|
29
|
+
import { validateDeterministicDefault } from '../validation/determinism-validator.js';
|
|
29
30
|
import { validateReturningQualifiers } from '../validation/returning-qualifier-validator.js';
|
|
30
31
|
import { isCommittedSchemaRef } from './schema-resolution.js';
|
|
31
32
|
import { buildViewMutation } from './view-mutation-builder.js';
|
|
@@ -174,22 +175,13 @@ function createGeneratedColumnProjection(ctx, sourceNode, tableSchema) {
|
|
|
174
175
|
const genColumn = tableSchema.columns[genColIdx];
|
|
175
176
|
if (!genColumn.generated || !genColumn.generatedExpr)
|
|
176
177
|
continue;
|
|
178
|
+
// The row this iteration computes from is the CURRENT node's output, not the
|
|
179
|
+
// table reference's: generated columns processed in earlier iterations carry
|
|
180
|
+
// their freshly-computed value there. Do not collapse the chain.
|
|
177
181
|
const inputAttributes = currentNode.getAttributes();
|
|
178
|
-
// Scope: every column resolves to the corresponding attribute in the
|
|
179
|
-
// current source. This includes generated columns processed in earlier
|
|
180
|
-
// iterations — their attribute carries the freshly-computed value.
|
|
181
|
-
const genScope = new RegisteredScope(ctx.scope);
|
|
182
|
-
tableSchema.columns.forEach((col, colIndex) => {
|
|
183
|
-
const attr = inputAttributes[colIndex];
|
|
184
|
-
genScope.registerSymbol(col.name.toLowerCase(), (exp, s) => new ColumnReferenceNode(s, exp, attr.type, attr.id, colIndex));
|
|
185
|
-
});
|
|
186
|
-
const genCtx = { ...ctx, scope: genScope };
|
|
187
182
|
const genProjections = tableSchema.columns.map((col, colIdx) => {
|
|
188
183
|
if (colIdx === genColIdx) {
|
|
189
|
-
const genNode =
|
|
190
|
-
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
191
|
-
validateDeterministicGenerated(genNode, genColumn.name, tableSchema.name);
|
|
192
|
-
}
|
|
184
|
+
const genNode = buildGeneratedColumnExpr(ctx, tableSchema, genColumn.name, genColumn.generatedExpr, inputAttributes);
|
|
193
185
|
return { node: genNode, alias: col.name };
|
|
194
186
|
}
|
|
195
187
|
const attr = inputAttributes[colIdx];
|
|
@@ -242,9 +234,12 @@ function resolveConflictTargetEnforcement(tableSchema, conflictTargetIndices) {
|
|
|
242
234
|
}
|
|
243
235
|
/**
|
|
244
236
|
* Register the conflicting row's columns on `scope`, under both the bare name and
|
|
245
|
-
* the `<table>.<name>` qualified form.
|
|
246
|
-
* unqualified names mean the existing row
|
|
247
|
-
*
|
|
237
|
+
* the `<table>.<name>` qualified form. Serves the DO UPDATE SET scope, where
|
|
238
|
+
* unqualified names mean the existing row — user-written SQL, which may name the
|
|
239
|
+
* target however the statement spells it. The generated-column recompute reads the
|
|
240
|
+
* same attributes but builds its own scope in {@link buildGeneratedColumnExpr}: a
|
|
241
|
+
* stored body must accept the same spellings at every write site, not the ones this
|
|
242
|
+
* statement happens to offer.
|
|
248
243
|
*/
|
|
249
244
|
function registerExistingRowColumns(scope, tableSchema, existingAttributes) {
|
|
250
245
|
existingAttributes.forEach((attr, columnIndex) => {
|
|
@@ -267,23 +262,20 @@ function registerExistingRowColumns(scope, tableSchema, existingAttributes) {
|
|
|
267
262
|
*
|
|
268
263
|
* The expressions get their OWN scope over the existing-row attributes rather than
|
|
269
264
|
* reusing the SET scope: schema-authored SQL must not be able to bind the
|
|
270
|
-
* statement's `new.` / `excluded.` symbols.
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
265
|
+
* statement's `new.` / `excluded.` symbols. That scope — and the
|
|
266
|
+
* `schemaAuthoredContext` wrapper — come from {@link buildGeneratedColumnExpr}, the
|
|
267
|
+
* one builder all four generated-expression sites share, so this recompute accepts
|
|
268
|
+
* exactly the spellings an INSERT, an UPDATE and an ADD COLUMN backfill accept.
|
|
269
|
+
* Only the generated arm routes through it: the DO UPDATE SET scope keeps its own
|
|
270
|
+
* `<table>.<col>` registration, which serves user-written SQL, not a stored body.
|
|
274
271
|
*/
|
|
275
272
|
function appendGeneratedRecomputes(ctx, tableSchema, existingAttributes, assignments) {
|
|
276
|
-
const generatedCtx = schemaAuthoredContext({ ...ctx, scope: registerExistingRowColumns(new RegisteredScope(ctx.scope), tableSchema, existingAttributes) }, tableSchema.schemaName);
|
|
277
273
|
const generatedAssignmentColumns = [];
|
|
278
274
|
for (const colIndex of tableSchema.generatedColumnTopoOrder ?? []) {
|
|
279
275
|
const col = tableSchema.columns[colIndex];
|
|
280
276
|
if (!col.generated || !col.generatedExpr)
|
|
281
277
|
continue;
|
|
282
|
-
|
|
283
|
-
if (!ctx.db.options.getBooleanOption('nondeterministic_schema')) {
|
|
284
|
-
validateDeterministicGenerated(genNode, col.name, tableSchema.name);
|
|
285
|
-
}
|
|
286
|
-
assignments.set(colIndex, genNode);
|
|
278
|
+
assignments.set(colIndex, buildGeneratedColumnExpr(ctx, tableSchema, col.name, col.generatedExpr, existingAttributes));
|
|
287
279
|
generatedAssignmentColumns.push(colIndex);
|
|
288
280
|
}
|
|
289
281
|
return generatedAssignmentColumns;
|
|
@@ -325,7 +317,7 @@ function buildUpsertUpdateValidation(ctx, schemaAuthoredCtx, tableReference, con
|
|
|
325
317
|
// cascaded ones). `runInsert` owns no ParentRestrictBatch, so unlike `runUpdate`
|
|
326
318
|
// the admitted case is enforced by that per-row pre-walk rather than one
|
|
327
319
|
// end-of-statement probe — same verdict, same message, no batching.
|
|
328
|
-
if (getBatchableRestrictFks(ctx.
|
|
320
|
+
if (getBatchableRestrictFks(ctx.db, tableSchema, 'update', undefined, lensRouted) === undefined) {
|
|
329
321
|
checks.push(...buildParentSideFKChecks(schemaAuthoredCtx, tableSchema, RowOpFlag.UPDATE, oldAttributes, newAttributes, contextAttributes));
|
|
330
322
|
}
|
|
331
323
|
}
|