@quereus/quereus 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/common/errors.d.ts +17 -0
- package/dist/src/common/errors.d.ts.map +1 -1
- package/dist/src/common/errors.js +21 -0
- package/dist/src/common/errors.js.map +1 -1
- package/dist/src/core/database-assertions.d.ts +4 -3
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +44 -14
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-events.d.ts +62 -0
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +88 -2
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-internal.d.ts +5 -2
- package/dist/src/core/database-internal.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.js +4 -2
- package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
- package/dist/src/core/database-materialized-views-plans.d.ts +12 -2
- package/dist/src/core/database-materialized-views-plans.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.d.ts +46 -0
- package/dist/src/core/database-materialized-views.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views.js +75 -4
- package/dist/src/core/database-materialized-views.js.map +1 -1
- package/dist/src/core/database.d.ts +9 -1
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +36 -10
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/derived-row-validator.d.ts.map +1 -1
- package/dist/src/core/derived-row-validator.js +7 -1
- package/dist/src/core/derived-row-validator.js.map +1 -1
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +15 -5
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/emit/ast-stringify.d.ts +18 -2
- package/dist/src/emit/ast-stringify.d.ts.map +1 -1
- package/dist/src/emit/ast-stringify.js +22 -4
- package/dist/src/emit/ast-stringify.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +19 -5
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +24 -20
- 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 +32 -5
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/ast.d.ts +58 -1
- package/dist/src/parser/ast.d.ts.map +1 -1
- package/dist/src/parser/parser.js +1 -1
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/parser/utils.d.ts +13 -1
- package/dist/src/parser/utils.d.ts.map +1 -1
- package/dist/src/parser/utils.js +14 -0
- package/dist/src/parser/utils.js.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.js +7 -2
- package/dist/src/planner/analysis/assertion-classifier.js.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts.map +1 -1
- package/dist/src/planner/analysis/assertion-hoist-cache.js +5 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js.map +1 -1
- package/dist/src/planner/analysis/change-scope.d.ts +11 -3
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -1
- package/dist/src/planner/analysis/change-scope.js +5 -4
- package/dist/src/planner/analysis/change-scope.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +13 -5
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/equi-correlation.d.ts +6 -1
- package/dist/src/planner/analysis/equi-correlation.d.ts.map +1 -1
- package/dist/src/planner/analysis/equi-correlation.js +8 -1
- package/dist/src/planner/analysis/equi-correlation.js.map +1 -1
- package/dist/src/planner/analysis/predicate-dependencies.d.ts +34 -0
- package/dist/src/planner/analysis/predicate-dependencies.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-dependencies.js +60 -0
- package/dist/src/planner/analysis/predicate-dependencies.js.map +1 -0
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.js +0 -26
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +53 -17
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +9 -5
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/create-assertion.d.ts.map +1 -1
- package/dist/src/planner/building/create-assertion.js +72 -1
- package/dist/src/planner/building/create-assertion.js.map +1 -1
- package/dist/src/planner/building/create-view.d.ts +6 -1
- package/dist/src/planner/building/create-view.d.ts.map +1 -1
- package/dist/src/planner/building/create-view.js +12 -3
- package/dist/src/planner/building/create-view.js.map +1 -1
- package/dist/src/planner/building/ddl.d.ts.map +1 -1
- package/dist/src/planner/building/ddl.js +6 -2
- package/dist/src/planner/building/ddl.js.map +1 -1
- package/dist/src/planner/building/delete.d.ts.map +1 -1
- package/dist/src/planner/building/delete.js +23 -10
- package/dist/src/planner/building/delete.js.map +1 -1
- package/dist/src/planner/building/dml-target.d.ts.map +1 -1
- package/dist/src/planner/building/dml-target.js +4 -0
- package/dist/src/planner/building/dml-target.js.map +1 -1
- package/dist/src/planner/building/drop-assertion.d.ts.map +1 -1
- package/dist/src/planner/building/drop-assertion.js +3 -1
- package/dist/src/planner/building/drop-assertion.js.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
- package/dist/src/planner/building/foreign-key-builder.js +7 -5
- package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
- package/dist/src/planner/building/function-call.d.ts +35 -0
- package/dist/src/planner/building/function-call.d.ts.map +1 -1
- package/dist/src/planner/building/function-call.js +53 -40
- package/dist/src/planner/building/function-call.js.map +1 -1
- package/dist/src/planner/building/insert.d.ts.map +1 -1
- package/dist/src/planner/building/insert.js +185 -48
- package/dist/src/planner/building/insert.js.map +1 -1
- package/dist/src/planner/building/materialized-view.d.ts.map +1 -1
- package/dist/src/planner/building/materialized-view.js +3 -1
- package/dist/src/planner/building/materialized-view.js.map +1 -1
- package/dist/src/planner/building/schema-authored-context.d.ts +69 -0
- package/dist/src/planner/building/schema-authored-context.d.ts.map +1 -0
- package/dist/src/planner/building/schema-authored-context.js +75 -0
- package/dist/src/planner/building/schema-authored-context.js.map +1 -0
- package/dist/src/planner/building/schema-resolution.d.ts.map +1 -1
- package/dist/src/planner/building/schema-resolution.js +7 -4
- package/dist/src/planner/building/schema-resolution.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +187 -2
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +414 -81
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-compound.js +2 -2
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/select-context.d.ts +91 -0
- package/dist/src/planner/building/select-context.d.ts.map +1 -1
- package/dist/src/planner/building/select-context.js +113 -0
- package/dist/src/planner/building/select-context.js.map +1 -1
- package/dist/src/planner/building/select-modifiers.d.ts +10 -3
- package/dist/src/planner/building/select-modifiers.d.ts.map +1 -1
- package/dist/src/planner/building/select-modifiers.js +29 -8
- package/dist/src/planner/building/select-modifiers.js.map +1 -1
- package/dist/src/planner/building/select-ordinal.d.ts +64 -19
- package/dist/src/planner/building/select-ordinal.d.ts.map +1 -1
- package/dist/src/planner/building/select-ordinal.js +79 -30
- package/dist/src/planner/building/select-ordinal.js.map +1 -1
- package/dist/src/planner/building/select-projections.d.ts +1 -1
- package/dist/src/planner/building/select-projections.d.ts.map +1 -1
- package/dist/src/planner/building/select-projections.js +18 -11
- package/dist/src/planner/building/select-projections.js.map +1 -1
- package/dist/src/planner/building/select-window.d.ts +13 -3
- package/dist/src/planner/building/select-window.d.ts.map +1 -1
- package/dist/src/planner/building/select-window.js +142 -37
- package/dist/src/planner/building/select-window.js.map +1 -1
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +129 -59
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/building/update.d.ts.map +1 -1
- package/dist/src/planner/building/update.js +27 -13
- package/dist/src/planner/building/update.js.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts +1 -1
- package/dist/src/planner/building/view-mutation-builder.d.ts.map +1 -1
- package/dist/src/planner/building/view-mutation-builder.js +102 -8
- package/dist/src/planner/building/view-mutation-builder.js.map +1 -1
- package/dist/src/planner/building/with.d.ts.map +1 -1
- package/dist/src/planner/building/with.js +34 -4
- package/dist/src/planner/building/with.js.map +1 -1
- package/dist/src/planner/cache/correlation-detector.d.ts +15 -0
- package/dist/src/planner/cache/correlation-detector.d.ts.map +1 -1
- package/dist/src/planner/cache/correlation-detector.js +26 -0
- package/dist/src/planner/cache/correlation-detector.js.map +1 -1
- package/dist/src/planner/cache/materialization-advisory.d.ts +7 -0
- package/dist/src/planner/cache/materialization-advisory.d.ts.map +1 -1
- package/dist/src/planner/cache/materialization-advisory.js +12 -3
- package/dist/src/planner/cache/materialization-advisory.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +9 -0
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js.map +1 -1
- package/dist/src/planner/framework/pass.d.ts +2 -0
- package/dist/src/planner/framework/pass.d.ts.map +1 -1
- package/dist/src/planner/framework/pass.js +15 -0
- package/dist/src/planner/framework/pass.js.map +1 -1
- package/dist/src/planner/mutation/backward-body.d.ts.map +1 -1
- package/dist/src/planner/mutation/backward-body.js +4 -1
- package/dist/src/planner/mutation/backward-body.js.map +1 -1
- package/dist/src/planner/mutation/body-context.d.ts +23 -0
- package/dist/src/planner/mutation/body-context.d.ts.map +1 -0
- package/dist/src/planner/mutation/body-context.js +26 -0
- package/dist/src/planner/mutation/body-context.js.map +1 -0
- package/dist/src/planner/mutation/cte-flatten.js +15 -2
- package/dist/src/planner/mutation/cte-flatten.js.map +1 -1
- package/dist/src/planner/mutation/decomposition.d.ts +8 -0
- package/dist/src/planner/mutation/decomposition.d.ts.map +1 -1
- package/dist/src/planner/mutation/decomposition.js +8 -3
- package/dist/src/planner/mutation/decomposition.js.map +1 -1
- package/dist/src/planner/mutation/lens-enforcement.js +1 -1
- package/dist/src/planner/mutation/multi-source.d.ts +7 -0
- package/dist/src/planner/mutation/multi-source.d.ts.map +1 -1
- package/dist/src/planner/mutation/multi-source.js +5 -0
- package/dist/src/planner/mutation/multi-source.js.map +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.d.ts.map +1 -1
- package/dist/src/planner/mutation/mutation-diagnostic.js.map +1 -1
- package/dist/src/planner/mutation/scope-transform.d.ts +32 -0
- package/dist/src/planner/mutation/scope-transform.d.ts.map +1 -1
- package/dist/src/planner/mutation/scope-transform.js +181 -33
- package/dist/src/planner/mutation/scope-transform.js.map +1 -1
- package/dist/src/planner/mutation/set-op.d.ts.map +1 -1
- package/dist/src/planner/mutation/set-op.js +66 -16
- package/dist/src/planner/mutation/set-op.js.map +1 -1
- package/dist/src/planner/mutation/single-source.d.ts.map +1 -1
- package/dist/src/planner/mutation/single-source.js +100 -24
- package/dist/src/planner/mutation/single-source.js.map +1 -1
- package/dist/src/planner/nodes/add-constraint-node.d.ts +15 -1
- package/dist/src/planner/nodes/add-constraint-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/add-constraint-node.js +10 -1
- package/dist/src/planner/nodes/add-constraint-node.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +14 -5
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +28 -21
- package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.d.ts +27 -2
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.js +49 -2
- package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/constraint-check-node.js +17 -19
- package/dist/src/planner/nodes/constraint-check-node.js.map +1 -1
- package/dist/src/planner/nodes/create-assertion-node.d.ts +2 -1
- package/dist/src/planner/nodes/create-assertion-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/create-assertion-node.js +5 -2
- package/dist/src/planner/nodes/create-assertion-node.js.map +1 -1
- package/dist/src/planner/nodes/cte-node.d.ts +19 -9
- package/dist/src/planner/nodes/cte-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/cte-node.js +25 -9
- package/dist/src/planner/nodes/cte-node.js.map +1 -1
- package/dist/src/planner/nodes/delete-node.d.ts +20 -2
- package/dist/src/planner/nodes/delete-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/delete-node.js +11 -2
- package/dist/src/planner/nodes/delete-node.js.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts +58 -1
- package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/dml-executor-node.js +107 -15
- package/dist/src/planner/nodes/dml-executor-node.js.map +1 -1
- package/dist/src/planner/nodes/drop-assertion-node.d.ts +2 -1
- package/dist/src/planner/nodes/drop-assertion-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/drop-assertion-node.js +5 -2
- package/dist/src/planner/nodes/drop-assertion-node.js.map +1 -1
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +12 -6
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +0 -5
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +17 -20
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/insert-node.d.ts +19 -2
- package/dist/src/planner/nodes/insert-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/insert-node.js +10 -2
- package/dist/src/planner/nodes/insert-node.js.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +42 -10
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.js +85 -16
- package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts +5 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +5 -0
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node.js +12 -0
- package/dist/src/planner/nodes/plan-node.js.map +1 -1
- package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/project-node.js +16 -35
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts +16 -2
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +8 -1
- package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
- package/dist/src/planner/nodes/returning-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/returning-node.js +13 -32
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts +0 -5
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +18 -24
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +89 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +64 -2
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/update-node.d.ts +19 -2
- package/dist/src/planner/nodes/update-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/update-node.js +10 -2
- package/dist/src/planner/nodes/update-node.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts +18 -0
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +59 -10
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/planning-context.d.ts +24 -0
- package/dist/src/planner/planning-context.d.ts.map +1 -1
- package/dist/src/planner/planning-context.js.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +78 -20
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.js +297 -71
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts +11 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js +46 -2
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts +7 -4
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +39 -5
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.js +6 -2
- package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js +10 -3
- package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js.map +1 -1
- package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -1
- package/dist/src/planner/rules/join/index-nested-loop.js +13 -7
- package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.d.ts +4 -0
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js +50 -15
- package/dist/src/planner/rules/join/rule-fanout-lookup-join.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts +6 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.js +25 -9
- package/dist/src/planner/rules/join/rule-join-elimination.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.d.ts +7 -0
- package/dist/src/planner/rules/join/rule-join-key-inference.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.js +23 -11
- package/dist/src/planner/rules/join/rule-join-key-inference.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts +2 -2
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.js +46 -16
- package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts +2 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +14 -0
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts +2 -2
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js +19 -22
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +33 -19
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +37 -18
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts +6 -3
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js +6 -3
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +11 -21
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/shared/access-leaf.d.ts +16 -3
- package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -1
- package/dist/src/planner/rules/shared/access-leaf.js +21 -5
- package/dist/src/planner/rules/shared/access-leaf.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -1
- package/dist/src/planner/stored-body-context.d.ts +57 -0
- package/dist/src/planner/stored-body-context.d.ts.map +1 -0
- package/dist/src/planner/stored-body-context.js +64 -0
- package/dist/src/planner/stored-body-context.js.map +1 -0
- package/dist/src/planner/util/ind-utils.d.ts +28 -20
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +36 -27
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts +19 -4
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +23 -7
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/planner/util/output-names.d.ts +12 -0
- package/dist/src/planner/util/output-names.d.ts.map +1 -0
- package/dist/src/planner/util/output-names.js +20 -0
- package/dist/src/planner/util/output-names.js.map +1 -0
- package/dist/src/planner/util/row-estimates.d.ts +11 -0
- package/dist/src/planner/util/row-estimates.d.ts.map +1 -1
- package/dist/src/planner/util/row-estimates.js +28 -0
- package/dist/src/planner/util/row-estimates.js.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.js +3 -2
- package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
- package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
- package/dist/src/runtime/emit/add-constraint.js +22 -6
- package/dist/src/runtime/emit/add-constraint.js.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.d.ts +59 -4
- package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.js +63 -4
- 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 +212 -92
- 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 +15 -4
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/assertion-drop-guard.d.ts +37 -0
- package/dist/src/runtime/emit/assertion-drop-guard.d.ts.map +1 -0
- package/dist/src/runtime/emit/assertion-drop-guard.js +59 -0
- package/dist/src/runtime/emit/assertion-drop-guard.js.map +1 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.d.ts +33 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.d.ts.map +1 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.js +124 -0
- package/dist/src/runtime/emit/assertion-rename-helpers.js.map +1 -0
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +10 -227
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/create-assertion.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-assertion.js +31 -14
- package/dist/src/runtime/emit/create-assertion.js.map +1 -1
- package/dist/src/runtime/emit/cte.d.ts.map +1 -1
- package/dist/src/runtime/emit/cte.js +11 -6
- package/dist/src/runtime/emit/cte.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +169 -1
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.js +8 -8
- package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
- package/dist/src/runtime/emit/drop-column-guards.d.ts +151 -0
- package/dist/src/runtime/emit/drop-column-guards.d.ts.map +1 -0
- package/dist/src/runtime/emit/drop-column-guards.js +230 -0
- package/dist/src/runtime/emit/drop-column-guards.js.map +1 -0
- package/dist/src/runtime/emit/drop-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-table.js +6 -0
- package/dist/src/runtime/emit/drop-table.js.map +1 -1
- package/dist/src/runtime/emit/drop-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-view.js +4 -0
- package/dist/src/runtime/emit/drop-view.js.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.js +5 -3
- package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts +4 -4
- package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view-helpers.js +34 -22
- package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -1
- package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
- package/dist/src/runtime/emit/materialized-view.js +7 -2
- package/dist/src/runtime/emit/materialized-view.js.map +1 -1
- package/dist/src/runtime/emit/recursive-cte.d.ts.map +1 -1
- package/dist/src/runtime/emit/recursive-cte.js +4 -5
- package/dist/src/runtime/emit/recursive-cte.js.map +1 -1
- package/dist/src/runtime/emit/update.d.ts.map +1 -1
- package/dist/src/runtime/emit/update.js +18 -6
- package/dist/src/runtime/emit/update.js.map +1 -1
- package/dist/src/runtime/row-constraints.d.ts +85 -0
- package/dist/src/runtime/row-constraints.d.ts.map +1 -0
- package/dist/src/runtime/row-constraints.js +239 -0
- package/dist/src/runtime/row-constraints.js.map +1 -0
- package/dist/src/runtime/types.d.ts +8 -11
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.js.map +1 -1
- package/dist/src/schema/assertion.d.ts +14 -1
- package/dist/src/schema/assertion.d.ts.map +1 -1
- package/dist/src/schema/assertion.js +14 -1
- package/dist/src/schema/assertion.js.map +1 -1
- package/dist/src/schema/catalog-persistability.js +19 -3
- package/dist/src/schema/catalog-persistability.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +6 -0
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +26 -36
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/column-source-resolver.d.ts +18 -0
- package/dist/src/schema/column-source-resolver.d.ts.map +1 -0
- package/dist/src/schema/column-source-resolver.js +22 -0
- package/dist/src/schema/column-source-resolver.js.map +1 -0
- package/dist/src/schema/constraint-builder.d.ts.map +1 -1
- package/dist/src/schema/constraint-builder.js +7 -1
- package/dist/src/schema/constraint-builder.js.map +1 -1
- package/dist/src/schema/ddl-generator.js +8 -0
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/lens-compiler.d.ts.map +1 -1
- package/dist/src/schema/lens-compiler.js +203 -51
- package/dist/src/schema/lens-compiler.js.map +1 -1
- package/dist/src/schema/lens-prover.d.ts +2 -3
- package/dist/src/schema/lens-prover.d.ts.map +1 -1
- package/dist/src/schema/lens-prover.js +19 -11
- package/dist/src/schema/lens-prover.js.map +1 -1
- package/dist/src/schema/manager.d.ts +30 -12
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +49 -17
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts +142 -0
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +254 -9
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/reserved-tags.d.ts +1 -1
- package/dist/src/schema/reserved-tags.d.ts.map +1 -1
- package/dist/src/schema/reserved-tags.js +4 -3
- package/dist/src/schema/reserved-tags.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts +16 -0
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +122 -11
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/view.d.ts +11 -0
- package/dist/src/schema/view.d.ts.map +1 -1
- package/dist/src/schema/view.js +12 -0
- package/dist/src/schema/view.js.map +1 -1
- package/dist/src/types/builtin-types.d.ts +38 -0
- package/dist/src/types/builtin-types.d.ts.map +1 -1
- package/dist/src/types/builtin-types.js +77 -26
- package/dist/src/types/builtin-types.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/util/{working-table-iterable.d.ts → array-row-iterable.d.ts} +6 -6
- package/dist/src/util/array-row-iterable.d.ts.map +1 -0
- package/dist/src/util/{working-table-iterable.js → array-row-iterable.js} +6 -6
- package/dist/src/util/array-row-iterable.js.map +1 -0
- package/dist/src/vtab/events.d.ts +3 -0
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js.map +1 -1
- package/dist/src/vtab/manifest.d.ts +15 -0
- package/dist/src/vtab/manifest.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +3 -69
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +16 -1
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +62 -2
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/module.d.ts +26 -2
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +8 -1
- package/dist/src/vtab/table.d.ts.map +1 -1
- package/dist/src/vtab/table.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/util/working-table-iterable.d.ts.map +0 -1
- package/dist/src/util/working-table-iterable.js.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ConstraintCheck } from '../planner/nodes/constraint-check-node.js';
|
|
2
|
+
import type { RuntimeContext } from './types.js';
|
|
3
|
+
import type { Row, OutputValue } from '../common/types.js';
|
|
4
|
+
import type { RowConstraintSchema, TableSchema } from '../schema/table.js';
|
|
5
|
+
import type { ColumnSchema } from '../schema/column.js';
|
|
6
|
+
import type { RowDescriptor } from '../planner/nodes/plan-node.js';
|
|
7
|
+
import { RowOpFlag } from '../schema/table.js';
|
|
8
|
+
import { ConflictResolution } from '../common/constants.js';
|
|
9
|
+
/**
|
|
10
|
+
* Row validation shared by every site that must enforce a table's CHECK / NOT NULL /
|
|
11
|
+
* synthesized FK-existence constraints against one flat OLD|NEW row.
|
|
12
|
+
*
|
|
13
|
+
* Two callers today:
|
|
14
|
+
* - `emit/constraint-check.ts` — the `ConstraintCheckNode` in a DML plan, which is
|
|
15
|
+
* where ordinary INSERT / UPDATE / DELETE rows are validated;
|
|
16
|
+
* - `emit/dml-executor.ts` — the `on conflict … do update` arm, which composes the
|
|
17
|
+
* row it writes *inside* the executor and so can never reach that node.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here knows about plan nodes: the two row-shape facts the algorithm needs
|
|
20
|
+
* are passed as a {@link RowConstraintScope}.
|
|
21
|
+
*/
|
|
22
|
+
/** The row-shape facts the evaluator needs, independent of which plan node supplied them. */
|
|
23
|
+
export interface RowConstraintScope {
|
|
24
|
+
operation: RowOpFlag;
|
|
25
|
+
/** True when the flat row carries a NEW section (false for a DELETE-shaped set). */
|
|
26
|
+
hasNewSection: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ConstraintMetadataEntry {
|
|
29
|
+
schema: RowConstraintSchema;
|
|
30
|
+
flatRowDescriptor: RowDescriptor;
|
|
31
|
+
evaluator: (ctx: RuntimeContext) => OutputValue;
|
|
32
|
+
constraintName: string;
|
|
33
|
+
constraintExpr: string;
|
|
34
|
+
shouldDefer: boolean;
|
|
35
|
+
baseTable: string;
|
|
36
|
+
contextDescriptor?: RowDescriptor;
|
|
37
|
+
kind: 'check' | 'fk-child' | 'fk-parent';
|
|
38
|
+
/** For 'fk-parent' UPDATE checks: parent-table column indices the FK references. */
|
|
39
|
+
referencedColumnIndices?: ReadonlyArray<number>;
|
|
40
|
+
}
|
|
41
|
+
export interface NotNullDefaultRuntime {
|
|
42
|
+
columnIndex: number;
|
|
43
|
+
evaluator: (ctx: RuntimeContext) => OutputValue;
|
|
44
|
+
/**
|
|
45
|
+
* Set when the DEFAULT expression's static type is not the column's declared
|
|
46
|
+
* type: the substituted value must then be converted before it is written
|
|
47
|
+
* into the (already-converted) NEW section — the same static-type rule the
|
|
48
|
+
* DML emitters applied to the rest of the row, which the substitution
|
|
49
|
+
* bypasses by injecting a value after that pass.
|
|
50
|
+
*/
|
|
51
|
+
coerceColumn?: ColumnSchema;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Result of evaluating constraints for a single row.
|
|
55
|
+
*
|
|
56
|
+
* - skip=true → caller should drop this row (IGNORE resolution)
|
|
57
|
+
* - replacedRow → caller should use this row instead of the input (REPLACE
|
|
58
|
+
* substituted a DEFAULT for a NOT NULL violation)
|
|
59
|
+
*/
|
|
60
|
+
export interface RowConstraintResult {
|
|
61
|
+
skip: boolean;
|
|
62
|
+
replacedRow?: Row;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build the per-check metadata the evaluator reads, once at emit time.
|
|
66
|
+
*
|
|
67
|
+
* `evaluators` are the emitted instructions' own `run` functions, index-aligned
|
|
68
|
+
* with `checks`; they are the fallback the evaluator uses when the scheduler did
|
|
69
|
+
* not supply a resolved function for that position.
|
|
70
|
+
*/
|
|
71
|
+
export declare function buildConstraintMetadata(checks: readonly ConstraintCheck[], tableSchema: TableSchema, flatRowDescriptor: RowDescriptor, contextDescriptor: RowDescriptor | undefined, evaluators: ReadonlyArray<(ctx: RuntimeContext) => OutputValue>): ConstraintMetadataEntry[];
|
|
72
|
+
/**
|
|
73
|
+
* Validate one flat OLD|NEW row against the table's NOT NULL columns and the
|
|
74
|
+
* pre-built CHECK / FK-existence checks.
|
|
75
|
+
*
|
|
76
|
+
* The caller must already have bound the row (composed with the mutation-context
|
|
77
|
+
* row when present) into the runtime context — the check expressions resolve
|
|
78
|
+
* their column references through it.
|
|
79
|
+
*
|
|
80
|
+
* `showRow` is invoked with the row as finally substituted, so a caller whose
|
|
81
|
+
* binding is a lazy getter can swap what the CHECK / FK expressions read after a
|
|
82
|
+
* REPLACE NOT NULL DEFAULT substitution.
|
|
83
|
+
*/
|
|
84
|
+
export declare function evaluateRowConstraints(rctx: RuntimeContext, scope: RowConstraintScope, tableSchema: TableSchema, flatRow: Row, metadata: ConstraintMetadataEntry[], evaluators: Array<(ctx: RuntimeContext) => OutputValue>, stmtOR: ConflictResolution | undefined, notNullDefaults: NotNullDefaultRuntime[], contextRow: Row | undefined, showRow: (row: Row) => void): Promise<RowConstraintResult>;
|
|
85
|
+
//# sourceMappingURL=row-constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-constraints.d.ts","sourceRoot":"","sources":["../../../src/runtime/row-constraints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAY,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAK5D;;;;;;;;;;;;GAYG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,oFAAoF;IACpF,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACvC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,aAAa,CAAC;IACjC,SAAS,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,WAAW,CAAC;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,aAAa,C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
|
2
|
+
import { RowOpFlag } from '../schema/table.js';
|
|
3
|
+
import { ConflictResolution } from '../common/constants.js';
|
|
4
|
+
import { expressionToString } from '../emit/ast-stringify.js';
|
|
5
|
+
import { sqlValueIdentical, isTruthy } from '../util/comparison.js';
|
|
6
|
+
import { validateAndParse } from '../types/validation.js';
|
|
7
|
+
/**
|
|
8
|
+
* The violation message for a failing constraint — single source of truth for the
|
|
9
|
+
* immediate (row-time) and deferred (commit-time) paths, which must report a row
|
|
10
|
+
* identically no matter when the check happened to run.
|
|
11
|
+
*
|
|
12
|
+
* Engine-level CHECK and synthesized FK existence checks share the
|
|
13
|
+
* "CHECK constraint failed" prefix for backward compatibility with existing
|
|
14
|
+
* assertions; downstream consumers identify FK by name. The expression text is
|
|
15
|
+
* appended as a hint only when short enough to stay readable.
|
|
16
|
+
*/
|
|
17
|
+
function constraintViolationMessage(metadata) {
|
|
18
|
+
const exprHint = metadata.constraintExpr.length <= 60 ? ` (${metadata.constraintExpr})` : '';
|
|
19
|
+
return `CHECK constraint failed: ${metadata.constraintName}${exprHint}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the effective conflict action for a single failure.
|
|
23
|
+
*
|
|
24
|
+
* Precedence: statement-level OR clause > per-constraint default > ABORT.
|
|
25
|
+
*/
|
|
26
|
+
function pickAction(stmtOR, constraintDefault) {
|
|
27
|
+
return stmtOR ?? constraintDefault ?? ConflictResolution.ABORT;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Throws an appropriate ConstraintError subclass based on the effective
|
|
31
|
+
* conflict action. ABORT/REPLACE/IGNORE callers must not reach this — IGNORE
|
|
32
|
+
* is handled by skipping the row, REPLACE by substitution / passthrough, and
|
|
33
|
+
* ABORT throws a plain ConstraintError.
|
|
34
|
+
*/
|
|
35
|
+
function throwForAction(action, message) {
|
|
36
|
+
if (action === ConflictResolution.FAIL) {
|
|
37
|
+
throw new FailConflictError(message);
|
|
38
|
+
}
|
|
39
|
+
if (action === ConflictResolution.ROLLBACK) {
|
|
40
|
+
throw new RollbackConflictError(message);
|
|
41
|
+
}
|
|
42
|
+
throw new ConstraintError(message);
|
|
43
|
+
}
|
|
44
|
+
function generateDefaultConstraintName(tableSchema, constraint) {
|
|
45
|
+
// Find the index of this constraint in the original array to get the correct constraint number
|
|
46
|
+
const originalIndex = tableSchema.checkConstraints.findIndex((c) => c === constraint);
|
|
47
|
+
return `_check_${originalIndex >= 0 ? originalIndex : 'unknown'}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build the per-check metadata the evaluator reads, once at emit time.
|
|
51
|
+
*
|
|
52
|
+
* `evaluators` are the emitted instructions' own `run` functions, index-aligned
|
|
53
|
+
* with `checks`; they are the fallback the evaluator uses when the scheduler did
|
|
54
|
+
* not supply a resolved function for that position.
|
|
55
|
+
*/
|
|
56
|
+
export function buildConstraintMetadata(checks, tableSchema, flatRowDescriptor, contextDescriptor, evaluators) {
|
|
57
|
+
return checks.map((check, idx) => ({
|
|
58
|
+
schema: check.constraint,
|
|
59
|
+
flatRowDescriptor,
|
|
60
|
+
evaluator: evaluators[idx],
|
|
61
|
+
constraintName: check.constraint.name ?? generateDefaultConstraintName(tableSchema, check.constraint),
|
|
62
|
+
constraintExpr: expressionToString(check.constraint.expr),
|
|
63
|
+
shouldDefer: Boolean(check.deferrable || check.initiallyDeferred || check.needsDeferred),
|
|
64
|
+
baseTable: `${tableSchema.schemaName}.${tableSchema.name}`,
|
|
65
|
+
contextDescriptor,
|
|
66
|
+
kind: check.kind ?? 'check',
|
|
67
|
+
referencedColumnIndices: check.referencedColumnIndices,
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validate one flat OLD|NEW row against the table's NOT NULL columns and the
|
|
72
|
+
* pre-built CHECK / FK-existence checks.
|
|
73
|
+
*
|
|
74
|
+
* The caller must already have bound the row (composed with the mutation-context
|
|
75
|
+
* row when present) into the runtime context — the check expressions resolve
|
|
76
|
+
* their column references through it.
|
|
77
|
+
*
|
|
78
|
+
* `showRow` is invoked with the row as finally substituted, so a caller whose
|
|
79
|
+
* binding is a lazy getter can swap what the CHECK / FK expressions read after a
|
|
80
|
+
* REPLACE NOT NULL DEFAULT substitution.
|
|
81
|
+
*/
|
|
82
|
+
export async function evaluateRowConstraints(rctx, scope, tableSchema, flatRow, metadata, evaluators, stmtOR, notNullDefaults, contextRow, showRow) {
|
|
83
|
+
// The row arrives with its NEW section already converted to declared column
|
|
84
|
+
// types (the DML emitters convert up front, driven by static types), so both
|
|
85
|
+
// passes read declared-form values. NOT NULL runs first: under OR REPLACE it
|
|
86
|
+
// may substitute a column's DEFAULT (converting that one injected value —
|
|
87
|
+
// see NotNullDefaultRuntime.coerceColumn), and CHECK / FK then read the row
|
|
88
|
+
// AS FINALLY SUBSTITUTED, which is also what flows on downstream.
|
|
89
|
+
let row = flatRow;
|
|
90
|
+
const nnResult = await checkNotNullConstraints(rctx, scope, tableSchema, row, stmtOR, notNullDefaults);
|
|
91
|
+
if (nnResult.skip)
|
|
92
|
+
return { skip: true };
|
|
93
|
+
if (nnResult.replacedRow)
|
|
94
|
+
row = nnResult.replacedRow;
|
|
95
|
+
showRow(row);
|
|
96
|
+
// CHECK constraints (and synthetic FK existence checks built as RowConstraintSchema).
|
|
97
|
+
const ckResult = await checkCheckConstraints(rctx, scope, tableSchema, metadata, evaluators, stmtOR, row, contextRow);
|
|
98
|
+
if (ckResult.skip)
|
|
99
|
+
return { skip: true };
|
|
100
|
+
return { skip: false, replacedRow: nnResult.replacedRow };
|
|
101
|
+
}
|
|
102
|
+
async function checkNotNullConstraints(rctx, scope, tableSchema, flatRow, stmtOR, notNullDefaults) {
|
|
103
|
+
if (scope.operation === RowOpFlag.DELETE) {
|
|
104
|
+
return { skip: false };
|
|
105
|
+
}
|
|
106
|
+
if (!scope.hasNewSection) {
|
|
107
|
+
return { skip: false };
|
|
108
|
+
}
|
|
109
|
+
const numCols = tableSchema.columns.length;
|
|
110
|
+
let mutableRow;
|
|
111
|
+
// NOT NULL attribution: report the FIRST NOT-NULL column (in declaration
|
|
112
|
+
// order) whose effective NEW value is NULL, naming that column itself —
|
|
113
|
+
// independent of which column any DEFAULT references. A NULL sibling named by
|
|
114
|
+
// another column's `new.<col>` DEFAULT violates its OWN NOT NULL and is
|
|
115
|
+
// reported on its own merits, never threaded into the defaulted column's
|
|
116
|
+
// message. (See test/logic/03.4-defaults.sqllogic, the NOT NULL default section.)
|
|
117
|
+
for (let i = 0; i < numCols; i++) {
|
|
118
|
+
const column = tableSchema.columns[i];
|
|
119
|
+
if (!column.notNull)
|
|
120
|
+
continue;
|
|
121
|
+
const newValueIndex = numCols + i; // NEW section: n..2n-1
|
|
122
|
+
const value = (mutableRow ?? flatRow)[newValueIndex];
|
|
123
|
+
if (value !== null && value !== undefined)
|
|
124
|
+
continue;
|
|
125
|
+
const action = pickAction(stmtOR, column.defaultConflict);
|
|
126
|
+
const message = `NOT NULL constraint failed: ${tableSchema.name}.${column.name}`;
|
|
127
|
+
if (action === ConflictResolution.IGNORE) {
|
|
128
|
+
return { skip: true };
|
|
129
|
+
}
|
|
130
|
+
if (action === ConflictResolution.REPLACE) {
|
|
131
|
+
// Try to substitute the column's DEFAULT.
|
|
132
|
+
const defaultEntry = notNullDefaults.find(d => d.columnIndex === i);
|
|
133
|
+
if (!defaultEntry) {
|
|
134
|
+
// No DEFAULT available — REPLACE cannot recover.
|
|
135
|
+
throw new ConstraintError(message);
|
|
136
|
+
}
|
|
137
|
+
let defaultValue = await defaultEntry.evaluator(rctx);
|
|
138
|
+
if (defaultValue === null || defaultValue === undefined) {
|
|
139
|
+
// DEFAULT itself is NULL — substitution does not satisfy NOT NULL.
|
|
140
|
+
throw new ConstraintError(message);
|
|
141
|
+
}
|
|
142
|
+
if (defaultEntry.coerceColumn) {
|
|
143
|
+
// The substituted value is injected AFTER the emitters' conversion
|
|
144
|
+
// pass, so convert it here by the same static-type rule. Conversion
|
|
145
|
+
// itself can produce NULL (JSON's text 'null'), which still violates
|
|
146
|
+
// NOT NULL.
|
|
147
|
+
defaultValue = validateAndParse(defaultValue, defaultEntry.coerceColumn.logicalType, defaultEntry.coerceColumn.name);
|
|
148
|
+
if (defaultValue === null) {
|
|
149
|
+
throw new ConstraintError(message);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (!mutableRow)
|
|
153
|
+
mutableRow = [...flatRow];
|
|
154
|
+
mutableRow[newValueIndex] = defaultValue;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
// ABORT / FAIL / ROLLBACK
|
|
158
|
+
throwForAction(action, message);
|
|
159
|
+
}
|
|
160
|
+
return { skip: false, replacedRow: mutableRow };
|
|
161
|
+
}
|
|
162
|
+
async function checkCheckConstraints(rctx, scope, tableSchema, constraintMetadata, evaluatorFunctions, stmtOR, flatRow, contextRow) {
|
|
163
|
+
for (let i = 0; i < constraintMetadata.length; i++) {
|
|
164
|
+
const metadata = constraintMetadata[i];
|
|
165
|
+
const evaluator = evaluatorFunctions[i] ?? metadata.evaluator;
|
|
166
|
+
// Trust-the-origin apply path: the synthesized parent-side FK RESTRICT (NOT EXISTS)
|
|
167
|
+
// check is the plan-time dual of the runtime RESTRICT pre-checks. While applying
|
|
168
|
+
// external row changes the receiver skips it (the origin already enforced RESTRICT at
|
|
169
|
+
// its own commit) - otherwise a cascade DML re-entering this executor under the apply
|
|
170
|
+
// flag would throw here, wedging the sync stream. Only 'fk-parent' checks are gated;
|
|
171
|
+
// user CHECKs and child-side FK existence checks are untouched.
|
|
172
|
+
// (See database-external-changes.ts and runtime/foreign-key-actions.ts for the runtime dual.)
|
|
173
|
+
if (metadata.kind === 'fk-parent' && rctx.db._isFkRestrictSuppressed())
|
|
174
|
+
continue;
|
|
175
|
+
// Parent-side FK UPDATE: skip the NOT EXISTS subquery when none of the
|
|
176
|
+
// referenced parent columns actually changed.
|
|
177
|
+
if (scope.operation === RowOpFlag.UPDATE &&
|
|
178
|
+
metadata.kind === 'fk-parent' &&
|
|
179
|
+
metadata.referencedColumnIndices) {
|
|
180
|
+
// Both halves are in stored (declared) form: OLD comes from the scan, NEW
|
|
181
|
+
// was converted by the DML emitter — so plain identity is the right test.
|
|
182
|
+
const numCols = tableSchema.columns.length;
|
|
183
|
+
let anyChanged = false;
|
|
184
|
+
for (const colIdx of metadata.referencedColumnIndices) {
|
|
185
|
+
const oldVal = flatRow[colIdx]; // OLD section: 0..n-1
|
|
186
|
+
const newVal = flatRow[numCols + colIdx]; // NEW section: n..2n-1
|
|
187
|
+
if (!sqlValueIdentical(oldVal, newVal)) {
|
|
188
|
+
anyChanged = true;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (!anyChanged)
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
// Resolve effective action up front; non-default actions (IGNORE/REPLACE/FAIL/ROLLBACK)
|
|
196
|
+
// must be applied at row time, so we cannot let those defer to commit.
|
|
197
|
+
const effectiveAction = pickAction(stmtOR, metadata.schema.defaultConflict);
|
|
198
|
+
const mustEvaluateNow = effectiveAction !== ConflictResolution.ABORT;
|
|
199
|
+
if (metadata.shouldDefer && !mustEvaluateNow) {
|
|
200
|
+
const activeConnectionId = rctx.activeConnection?.connectionId;
|
|
201
|
+
// Wrap so the deferred queue's evaluation at COMMIT throws the same
|
|
202
|
+
// attributed message as the immediate path below, instead of the queue's
|
|
203
|
+
// generic name-only fallback — matches the pattern derived-row-validator.ts
|
|
204
|
+
// already uses for maintained tables. The wrapper always throws before
|
|
205
|
+
// returning falsy, so the queue's own generic message never fires here.
|
|
206
|
+
// Only ABORT reaches this branch (see mustEvaluateNow), so throwing is the
|
|
207
|
+
// whole of the deferred failure contract — no IGNORE/REPLACE leg needed.
|
|
208
|
+
const message = constraintViolationMessage(metadata);
|
|
209
|
+
const deferredEvaluator = async (dctx) => {
|
|
210
|
+
const rawResult = evaluator(dctx);
|
|
211
|
+
const result = (rawResult instanceof Promise ? await rawResult : rawResult);
|
|
212
|
+
if (result !== null && !isTruthy(result)) {
|
|
213
|
+
throw new ConstraintError(message);
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
};
|
|
217
|
+
rctx.db._queueDeferredConstraintRow(metadata.baseTable, metadata.constraintName, flatRow, metadata.flatRowDescriptor, deferredEvaluator, activeConnectionId, contextRow, metadata.contextDescriptor);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// Resolve without a per-row microtask hop (see runtime/async-util.ts).
|
|
221
|
+
const rawResult = evaluator(rctx);
|
|
222
|
+
const result = (rawResult instanceof Promise ? await rawResult : rawResult);
|
|
223
|
+
// CHECK passes if truthy or NULL; fails otherwise (shared isTruthy semantics).
|
|
224
|
+
if (result !== null && !isTruthy(result)) {
|
|
225
|
+
const baseMessage = constraintViolationMessage(metadata);
|
|
226
|
+
if (effectiveAction === ConflictResolution.IGNORE) {
|
|
227
|
+
return { skip: true };
|
|
228
|
+
}
|
|
229
|
+
// REPLACE does NOT mask CHECK / FK violations — fall through to abort.
|
|
230
|
+
// (SQLite's OR REPLACE only relaxes UNIQUE/PK and NOT-NULL; CHECK still aborts.)
|
|
231
|
+
if (effectiveAction === ConflictResolution.REPLACE) {
|
|
232
|
+
throw new ConstraintError(baseMessage);
|
|
233
|
+
}
|
|
234
|
+
throwForAction(effectiveAction, baseMessage);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return { skip: false };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=row-constraints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-constraints.js","sourceRoot":"","sources":["../../../src/runtime/row-constraints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIhG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,C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AAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1C,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;gBACpC,CAAC;gBACD,OAAO,MAAM,CAAC;YACf,CAAC,CAAC;YACF,IAAI,CAAC,EAAE,CAAC,2BAA2B,CAClC,QAAQ,CAAC,SAAS,EAClB,QAAQ,CAAC,cAAc,EACvB,OAAO,EACP,QAAQ,CAAC,iBAAiB,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,QAAQ,CAAC,iBAAiB,CAC1B,CAAC;YACF,SAAS;QACV,CAAC;QAED,uEAAuE;QACvE,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,CAAC,SAAS,YAAY,OAAO,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,CAAa,CAAC;QAExF,+EAA+E;QAC/E,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1C,MAAM,WAAW,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;YAEzD,IAAI,eAAe,KAAK,kBAAkB,CAAC,MAAM,EAAE,CAAC;gBACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YACvB,CAAC;YAED,uEAAuE;YACvE,iFAAiF;YACjF,IAAI,eAAe,KAAK,kBAAkB,CAAC,OAAO,EAAE,CAAC;gBACpD,MAAM,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;YACxC,CAAC;YAED,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -104,18 +104,15 @@ export type RuntimeContext = {
|
|
|
104
104
|
* source subtree. A fresh RuntimeContext per execution resets the map between
|
|
105
105
|
* prepared-statement runs (no stale replay). Mirrors {@link cacheStates}.
|
|
106
106
|
*
|
|
107
|
-
*
|
|
108
|
-
* object
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* instances by earlier optimizer passes (distinct plan ids), but every copy
|
|
115
|
-
* preserves the one `tableDescriptor` identity through `withChildren`, so the
|
|
116
|
-
* descriptor — not the plan id — is what the copies agree on.
|
|
107
|
+
* Both {@link emitCTE} and {@link emitRecursiveCTE} key by the CTE's
|
|
108
|
+
* `TableDescriptor` — the identity object minted when the CTE is built and
|
|
109
|
+
* threaded through every optimizer rebuild. The plan id would NOT do: the
|
|
110
|
+
* optimizer may split one CTE node into several instances (a multi-referenced
|
|
111
|
+
* recursive CTE is duplicated outright; a node reachable from two parents is
|
|
112
|
+
* rebuilt once per path by the constant-folding pass), and per-id keying would
|
|
113
|
+
* give each copy a private buffer and re-drive the source.
|
|
117
114
|
*/
|
|
118
|
-
cteMaterializations?: Map<
|
|
115
|
+
cteMaterializations?: Map<TableDescriptor, Promise<Row[]>>;
|
|
119
116
|
/**
|
|
120
117
|
* Per-execution materialized lookup sets for uncorrelated, functional
|
|
121
118
|
* `x IN (subquery)` probes ({@link import('./emit/subquery.js').emitIn}), keyed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB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AO5E,oBAAoB,IAAI,OAAO;CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/types.ts"],"names":[],"mappings":"AAiJA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,KAAK,CACpB,GAAyD;IAEzD,OAAO,GAAgC,CAAC;AACzC,CAAC;AAwDD,kEAAkE;AAClE,MAAM,OAAO,2BAA2B;IAC/B,MAAM,GAA4B,EAAE,CAAC;IACrC,WAAW,GAAG,IAAI,GAAG,EAAoE,CAAC;IAC1F,gBAAgB,GAAG,CAAC,CAAC;IAE7B,UAAU,CAAC,gBAAwB,EAAE,WAAwB,EAAE,IAAoB;QAClF,MAAM,WAAW,GAAG,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QAE9E,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAChB,gBAAgB;YAChB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAC1B,WAAW;SACX,CAAC,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,gBAAwB,EAAE,WAAwB,EAAE,MAAmB;QAClF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAChB,gBAAgB;YAChB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;SAChC,CAAC,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,gBAAwB,EAAE,WAAwB,EAAE,KAAY;QAC1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AQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEpD,UAAU,CAAC,UAAyB,EAAE,MAAc;QACnD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,UAAyB;QACtC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED,oBAAoB;QACnB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;YACzE,UAAU;YACV,MAAM;SACN,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IAC/B,CAAC;CACD"}
|
|
@@ -6,8 +6,10 @@ export interface AssertionDependentTable {
|
|
|
6
6
|
base: string;
|
|
7
7
|
}
|
|
8
8
|
export interface IntegrityAssertionSchema {
|
|
9
|
-
/**
|
|
9
|
+
/** Assertion name, unique within its schema */
|
|
10
10
|
name: string;
|
|
11
|
+
/** Canonical name of the schema the assertion lives in (see SchemaManager.canonicalSchemaName) */
|
|
12
|
+
schemaName: string;
|
|
11
13
|
/** SQL text of the violation-producing query. Any returned row indicates a violation. */
|
|
12
14
|
violationSql: string;
|
|
13
15
|
/** Whether the assertion is deferrable. Currently always enforced at COMMIT. */
|
|
@@ -24,4 +26,15 @@ export interface IntegrityAssertionSchema {
|
|
|
24
26
|
*/
|
|
25
27
|
checkExpression?: AST.Expression;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Renders the violation-producing query an assertion's CHECK expression implies:
|
|
31
|
+
* `check (<expr>)` holds exactly when `select 1 where not (<expr>)` returns no
|
|
32
|
+
* row, so any row it returns is a violation. The commit-time evaluator re-parses
|
|
33
|
+
* and re-plans this text (see `AssertionEvaluator.getOrCompilePlan`).
|
|
34
|
+
*
|
|
35
|
+
* Shared by `CREATE ASSERTION` and the `ALTER TABLE … RENAME` propagation, so a
|
|
36
|
+
* body rewritten by a rename regenerates byte-identically to what a fresh create
|
|
37
|
+
* would have produced for the same expression.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildAssertionViolationSql(check: AST.Expression): string;
|
|
27
40
|
//# sourceMappingURL=assertion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion.d.ts","sourceRoot":"","sources":["../../../src/schema/assertion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"assertion.d.ts","sourceRoot":"","sources":["../../../src/schema/assertion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAG7C,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,kGAAkG;IAClG,UAAU,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,eAAe,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC5C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,CAAC,UAAU,GAAG,MAAM,CAExE"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { expressionToString } from '../emit/ast-stringify.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the violation-producing query an assertion's CHECK expression implies:
|
|
4
|
+
* `check (<expr>)` holds exactly when `select 1 where not (<expr>)` returns no
|
|
5
|
+
* row, so any row it returns is a violation. The commit-time evaluator re-parses
|
|
6
|
+
* and re-plans this text (see `AssertionEvaluator.getOrCompilePlan`).
|
|
7
|
+
*
|
|
8
|
+
* Shared by `CREATE ASSERTION` and the `ALTER TABLE … RENAME` propagation, so a
|
|
9
|
+
* body rewritten by a rename regenerates byte-identically to what a fresh create
|
|
10
|
+
* would have produced for the same expression.
|
|
11
|
+
*/
|
|
12
|
+
export function buildAssertionViolationSql(check) {
|
|
13
|
+
return `select 1 where not (${expressionToString(check)})`;
|
|
14
|
+
}
|
|
2
15
|
//# sourceMappingURL=assertion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion.js","sourceRoot":"","sources":["../../../src/schema/assertion.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"assertion.js","sourceRoot":"","sources":["../../../src/schema/assertion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA+B9D;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAqB;IAC/D,OAAO,uBAAuB,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC;AAC5D,CAAC"}
|
|
@@ -85,8 +85,9 @@ function assertRenameDependentViewsPersistable(db, schema, rewrite) {
|
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* The dependent-TABLE arm of {@link assertRenameDependentsPersistable}: a rename rewrites
|
|
88
|
-
* the FK targets, CHECK expressions
|
|
89
|
-
* renamed object, and a store-backed one of those has
|
|
88
|
+
* the FK targets, CHECK expressions, partial-index predicates and column DEFAULT / generated
|
|
89
|
+
* expressions of tables that mention the renamed object, and a store-backed one of those has
|
|
90
|
+
* to re-persist its catalog entry.
|
|
90
91
|
*
|
|
91
92
|
* Walks EVERY schema, not just the renamed object's own, because the propagation's table
|
|
92
93
|
* loop does (`propagateTableRename` iterates `_getAllSchemas()`) — a cross-schema foreign
|
|
@@ -112,10 +113,16 @@ function assertRenameDependentTablesPersistable(db, rewriteTable) {
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
* A shallow copy of `table` whose in-place-rewritable ASTs
|
|
116
|
+
* A shallow copy of `table` whose in-place-rewritable ASTs — CHECK expressions, partial-index
|
|
117
|
+
* predicates, and each column's DEFAULT / generated expression — are {@link spineCloneAst}
|
|
116
118
|
* copies, so a prospective rewrite cannot touch the live catalog. `foreignKeys` needs no
|
|
117
119
|
* clone — that arm of both table rewriters is already copy-on-write (it builds a new `fk`
|
|
118
120
|
* record rather than assigning into the existing one).
|
|
121
|
+
*
|
|
122
|
+
* The column arm matters for exactly the reason the others do: `runRenameColumn` runs this
|
|
123
|
+
* probe BEFORE its first side effect, and a module veto thrown afterwards must leave the
|
|
124
|
+
* catalog untouched. Without the clone the probe would rewrite the LIVE default AST and a
|
|
125
|
+
* vetoed statement would leave a table whose defaults name a column that was never renamed.
|
|
119
126
|
*/
|
|
120
127
|
// NOTE: a unique partial index and its derived UNIQUE constraint share ONE predicate node by
|
|
121
128
|
// reference (see `appendIndexToTableSchema`), which is how the live propagation rewrites both
|
|
@@ -128,6 +135,15 @@ function cloneTableRewritableAsts(table) {
|
|
|
128
135
|
...table,
|
|
129
136
|
checkConstraints: table.checkConstraints.map(cc => ({ ...cc, expr: spineCloneAst(cc.expr) })),
|
|
130
137
|
indexes: table.indexes?.map(idx => idx.predicate ? { ...idx, predicate: spineCloneAst(idx.predicate) } : idx),
|
|
138
|
+
columns: table.columns.map(col => {
|
|
139
|
+
if (!col.defaultValue && !col.generatedExpr)
|
|
140
|
+
return col;
|
|
141
|
+
return {
|
|
142
|
+
...col,
|
|
143
|
+
defaultValue: col.defaultValue ? spineCloneAst(col.defaultValue) : col.defaultValue,
|
|
144
|
+
generatedExpr: col.generatedExpr ? spineCloneAst(col.generatedExpr) : col.generatedExpr,
|
|
145
|
+
};
|
|
146
|
+
}),
|
|
131
147
|
};
|
|
132
148
|
}
|
|
133
149
|
/** Whether any registered module implements the veto hook at all — the same presence
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-persistability.js","sourceRoot":"","sources":["../../../src/schema/catalog-persistability.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,8BAA8B,CAC7C,EAAY,EACZ,IAAuB,EACvB,MAAgC;IAEhC,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC;QACxD,MAAM,CAAC,8BAA8B,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC;AAiBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yFAAyF;AACzF,0FAA0F;AAC1F,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,qFAAqF;AACrF,mFAAmF;AACnF,MAAM,UAAU,iCAAiC,CAChD,EAAY,EACZ,MAAc,EACd,OAAoB,EACpB,YAA0B;IAE1B,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAAE,OAAO;IAClC,qCAAqC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3D,sCAAsC,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,qCAAqC,CAAC,EAAY,EAAE,MAAc,EAAE,OAAoB;IAChG,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EA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AAO,GAAG,CAAC;YACxD,OAAO;gBACN,GAAG,GAAG;gBACN,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY;gBACnF,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa;aACvF,CAAC;QACH,CAAC,CAAC;KACF,CAAC;AACH,CAAC;AAED;;6EAE6E;AAC7E,SAAS,gBAAgB,CAAC,EAAY;IACrC,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC;QACxD,IAAI,MAAM,CAAC,8BAA8B;YAAE,OAAO,IAAI,CAAC;IACxD,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -115,6 +115,12 @@ export interface CatalogIndex {
|
|
|
115
115
|
export interface CatalogAssertion {
|
|
116
116
|
name: string;
|
|
117
117
|
ddl: string;
|
|
118
|
+
/**
|
|
119
|
+
* Canonical CHECK-expression rendering (name / schema excluded), so the
|
|
120
|
+
* differ compares bodies without name-qualification noise, mirroring
|
|
121
|
+
* `CatalogView.definition` / `CatalogIndex.definition`.
|
|
122
|
+
*/
|
|
123
|
+
definition: string;
|
|
118
124
|
}
|
|
119
125
|
/**
|
|
120
126
|
* Collects current schema state from the database into a catalog representation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/schema/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAe,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAMtG,OAAO,KAAK,KAAK,GAAG,MAAM,kBAAk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