@quereus/quereus 4.20.1 → 4.20.2
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 -0
- package/package.json +7 -4
- package/test/README.md +173 -0
- package/test/logic/01-basic.sqllogic +39 -0
- package/test/logic/01.1-select-projection-extras.sqllogic +130 -0
- package/test/logic/01.2-strings.sqllogic +43 -0
- package/test/logic/01.5-insert-select.sqllogic +237 -0
- package/test/logic/01.6-update-extras.sqllogic +118 -0
- package/test/logic/01.7-update-from.sqllogic +67 -0
- package/test/logic/01.8-delete-extras.sqllogic +122 -0
- package/test/logic/01.8.1-delete-range-cow.sqllogic +115 -0
- package/test/logic/01.9-query-expr-dml-gates.sqllogic +32 -0
- package/test/logic/01.9-query-expr-dml.sqllogic +171 -0
- package/test/logic/01.9-query-expr-values.sqllogic +111 -0
- package/test/logic/01.9.1-limit-over-dml-subquery.sqllogic +119 -0
- package/test/logic/02-filters.sqllogic +54 -0
- package/test/logic/02-smoke.sqllogic +62 -0
- package/test/logic/02.1-bind-parameters.sqllogic +223 -0
- package/test/logic/03-expressions.sqllogic +190 -0
- package/test/logic/03.1-quoted-identifiers.sqllogic +55 -0
- package/test/logic/03.4-defaults.sqllogic +554 -0
- package/test/logic/03.4.1-default-edge-cases.sqllogic +99 -0
- package/test/logic/03.5-tvf.sqllogic +61 -0
- package/test/logic/03.6-type-system.sqllogic +544 -0
- package/test/logic/03.6.1-numeric-text-comparison-coercion.sqllogic +244 -0
- package/test/logic/03.6.2-value-to-text.sqllogic +224 -0
- package/test/logic/03.7-bigint-mixed-arithmetic.sqllogic +65 -0
- package/test/logic/03.8-not-precedence.sqllogic +255 -0
- package/test/logic/03.9-is-bool-predicate.sqllogic +150 -0
- package/test/logic/03.9.1-is-bool-predicate-partial-index.sqllogic +34 -0
- package/test/logic/04-order-by.sqllogic +38 -0
- package/test/logic/04-transactions.sqllogic +239 -0
- package/test/logic/04a-savepoint-lazy-attach.sqllogic +122 -0
- package/test/logic/05-vtab_memory.sqllogic +50 -0
- package/test/logic/05.0.1-vtab-memory-unique-index-collation.sqllogic +34 -0
- package/test/logic/05.1-composite-pk-range-scan.sqllogic +147 -0
- package/test/logic/05.1.1-secondary-index-range-scan.sqllogic +56 -0
- package/test/logic/05.2-cast-seek-correctness.sqllogic +124 -0
- package/test/logic/06-builtin_functions.sqllogic +149 -0
- package/test/logic/06.1-string-functions.sqllogic +92 -0
- package/test/logic/06.1.3-like-glob-edges.sqllogic +53 -0
- package/test/logic/06.2-math-functions.sqllogic +82 -0
- package/test/logic/06.3-schema.sqllogic +48 -0
- package/test/logic/06.3.1-schema-all-schemas.sqllogic +39 -0
- package/test/logic/06.3.2-schema-foreign-keys.sqllogic +208 -0
- package/test/logic/06.3.3-introspection-tags.sqllogic +202 -0
- package/test/logic/06.3.3.1-introspection-tags-index.sqllogic +74 -0
- package/test/logic/06.3.4-view-info.sqllogic +378 -0
- package/test/logic/06.3.5-column-info.sqllogic +347 -0
- package/test/logic/06.3.6-schema-views.sqllogic +29 -0
- package/test/logic/06.4-schema-search-path.sqllogic +354 -0
- package/test/logic/06.4.1-schema-case-insensitive.sqllogic +83 -0
- package/test/logic/06.4.2-collation-extras.sqllogic +472 -0
- package/test/logic/06.4.2.1-collation-index-access-paths.sqllogic +140 -0
- package/test/logic/06.4.3-write-path-collation.sqllogic +99 -0
- package/test/logic/06.4.4-comparison-collation-precedence.sqllogic +342 -0
- package/test/logic/06.4.5-any-collate-declared-keys.sqllogic +92 -0
- package/test/logic/06.5-polymorphic-types.sqllogic +169 -0
- package/test/logic/06.5.1-conversion-functions.sqllogic +173 -0
- package/test/logic/06.5.2-scalar-minmax.sqllogic +16 -0
- package/test/logic/06.5.3-undeclared-return-type-comparison.sqllogic +244 -0
- package/test/logic/06.5.4-declared-return-type-builtins.sqllogic +288 -0
- package/test/logic/06.6-aggregate-extended.sqllogic +78 -0
- package/test/logic/06.7-json-extended.sqllogic +53 -0
- package/test/logic/06.8-json-path-operators.sqllogic +99 -0
- package/test/logic/06.9-json-canonical-key.sqllogic +65 -0
- package/test/logic/06.9.1-json-coerce-once.sqllogic +417 -0
- package/test/logic/06.9.1.1-json-coerce-once-index.sqllogic +39 -0
- package/test/logic/06.9.2-json-structural-equality.sqllogic +382 -0
- package/test/logic/06.9.2.1-json-structural-equality-index.sqllogic +76 -0
- package/test/logic/06.9.3-json-index-range-seek.sqllogic +205 -0
- package/test/logic/07-aggregates.sqllogic +193 -0
- package/test/logic/07.1-aggregate-filter-clause.sqllogic +12 -0
- package/test/logic/07.2-aggregate-order-by.sqllogic +11 -0
- package/test/logic/07.3-group-by-extras.sqllogic +602 -0
- package/test/logic/07.3.1-group-by-order-by-key.sqllogic +164 -0
- package/test/logic/07.3.2-grouped-select-list-shape.sqllogic +231 -0
- package/test/logic/07.4-group-by-filter-composite-pk.sqllogic +120 -0
- package/test/logic/07.5-sum-mixed-exact-and-float.sqllogic +151 -0
- package/test/logic/07.5-window.sqllogic +1941 -0
- package/test/logic/07.5.1-window-named.sqllogic +13 -0
- package/test/logic/07.5.2-window-nth-value.sqllogic +13 -0
- package/test/logic/07.6-subqueries.sqllogic +78 -0
- package/test/logic/07.6.1-subquery-extras.sqllogic +93 -0
- package/test/logic/07.7-and-or-short-circuit.sqllogic +58 -0
- package/test/logic/07.7-in-subquery-caching.sqllogic +174 -0
- package/test/logic/07.7-scalar-agg-decorrelation.sqllogic +197 -0
- package/test/logic/07.7.1-in-extras.sqllogic +158 -0
- package/test/logic/07.7.1-scalar-agg-decorrelation-filter.sqllogic +105 -0
- package/test/logic/07.7.2-scalar-agg-decorrelation-nested.sqllogic +115 -0
- package/test/logic/07.7.3-exists-in-select-decorrelation.sqllogic +107 -0
- package/test/logic/07.7.4-where-conjunct-ordering.sqllogic +121 -0
- package/test/logic/07.7.5-filter-lost-under-index-order.sqllogic +134 -0
- package/test/logic/07.7.6-correlated-predicate-scope.sqllogic +178 -0
- package/test/logic/07.7.7-join-source-scope-shadowing.sqllogic +137 -0
- package/test/logic/07.7.8-correlated-ref-to-computed-column.sqllogic +165 -0
- package/test/logic/07.7.9-conjunct-monotonicity.sqllogic +200 -0
- package/test/logic/07.8-correlated-subquery-edges.sqllogic +71 -0
- package/test/logic/07.8.1-correlated-in-decorrelation-gates.sqllogic +156 -0
- package/test/logic/07.9-in-value-list.sqllogic +154 -0
- package/test/logic/07.9.1-in-value-list-composite-index.sqllogic +38 -0
- package/test/logic/08-views.sqllogic +64 -0
- package/test/logic/08.1-semi-anti-join.sqllogic +191 -0
- package/test/logic/08.1-view-edge-cases.sqllogic +118 -0
- package/test/logic/08.1.1-uncorrelated-in-semijoin.sqllogic +251 -0
- package/test/logic/08.2-existence-flag-semijoin-recovery.sqllogic +197 -0
- package/test/logic/08.3-existence-flag-inner-recovery.sqllogic +102 -0
- package/test/logic/08.4-key-set-semi-join.sqllogic +447 -0
- package/test/logic/09-set_operations.sqllogic +244 -0
- package/test/logic/09.1-set-op-cross-collation.sqllogic +230 -0
- package/test/logic/10-distinct_datatypes.sqllogic +127 -0
- package/test/logic/10.1-ddl-lifecycle.sqllogic +203 -0
- package/test/logic/10.1.1-create-table-syntax-edges.sqllogic +47 -0
- package/test/logic/10.1.2-ddl-in-transaction.sqllogic +143 -0
- package/test/logic/10.1.2.1-add-constraint-in-transaction.sqllogic +59 -0
- package/test/logic/10.1.3-ddl-drop-in-transaction.sqllogic +187 -0
- package/test/logic/10.1.3.1-drop-constraint-in-transaction.sqllogic +45 -0
- package/test/logic/10.1.4-create-table-duplicate-constraint-names.sqllogic +149 -0
- package/test/logic/10.1.4-ddl-transaction-policy.sqllogic +314 -0
- package/test/logic/10.1.5-alter-add-constraint-minted-name-disambiguation.sqllogic +219 -0
- package/test/logic/10.1.5-create-index-lifecycle.sqllogic +72 -0
- package/test/logic/10.1.6-ddl-transaction-policy-index.sqllogic +143 -0
- package/test/logic/10.1.7-create-table-default-type-check.sqllogic +119 -0
- package/test/logic/10.1.8-alter-add-check-existing-rows.sqllogic +117 -0
- package/test/logic/10.2-column-features.sqllogic +365 -0
- package/test/logic/10.2.1-table-options-rejection.sqllogic +63 -0
- package/test/logic/10.2.2-default-collation-memory.sqllogic +30 -0
- package/test/logic/10.3-function-features.sqllogic +247 -0
- package/test/logic/10.4-schema-scale.sqllogic +168 -0
- package/test/logic/10.4.1-schema-scale-indexes.sqllogic +121 -0
- package/test/logic/10.5-indexes.sqllogic +164 -0
- package/test/logic/10.5.1-partial-indexes.sqllogic +526 -0
- package/test/logic/10.5.2-expression-indexes.sqllogic +34 -0
- package/test/logic/10.5.3-desc-index-ordering.sqllogic +130 -0
- package/test/logic/10.5.4-composite-pk-index-update-phantom.sqllogic +55 -0
- package/test/logic/10.5.5-index-name-uniqueness.sqllogic +76 -0
- package/test/logic/10.5.6-minmax-index-boundary.sqllogic +204 -0
- package/test/logic/10.5.7-implicit-unique-index-lifecycle.sqllogic +1216 -0
- package/test/logic/10.6-distinct-edge-cases.sqllogic +119 -0
- package/test/logic/100-predicate-normalization-edge-cases.sqllogic +238 -0
- package/test/logic/100.1-where-extras.sqllogic +163 -0
- package/test/logic/100.1.1-where-join-on-order-indexed.sqllogic +35 -0
- package/test/logic/101-builtin-mutation-kills.sqllogic +974 -0
- package/test/logic/101-transaction-edge-cases.sqllogic +395 -0
- package/test/logic/102-schema-catalog-edge-cases.sqllogic +252 -0
- package/test/logic/102-unique-constraints.sqllogic +145 -0
- package/test/logic/102.0.1-schema-catalog-indexed-table.sqllogic +32 -0
- package/test/logic/102.1-unique-edge-cases.sqllogic +111 -0
- package/test/logic/102.1.1-unique-index-creation-edge-cases.sqllogic +75 -0
- package/test/logic/102.2-unique-collation.sqllogic +181 -0
- package/test/logic/102.2.1-unique-collation-index-derived.sqllogic +305 -0
- package/test/logic/103-database-options-edge-cases.sqllogic +108 -0
- package/test/logic/103.1-pragma-boolean-values.sqllogic +126 -0
- package/test/logic/104-emit-mutation-kills.sqllogic +236 -0
- package/test/logic/105-vtab-memory-mutation-kills.sqllogic +754 -0
- package/test/logic/105.1-vtab-memory-index-mutation-kills.sqllogic +540 -0
- package/test/logic/106-constraint-extractor-mutation-kills.sqllogic +350 -0
- package/test/logic/107-temporal-arithmetic-mutation-kills.sqllogic +833 -0
- package/test/logic/108-cardinality-estimation.sqllogic +146 -0
- package/test/logic/108.1-analyze-name-resolution.sqllogic +102 -0
- package/test/logic/109-aggregate-physical-selection.sqllogic +103 -0
- package/test/logic/11-joins.sqllogic +86 -0
- package/test/logic/11.1-join-using.sqllogic +267 -0
- package/test/logic/11.2-comma-join.sqllogic +35 -0
- package/test/logic/11.3-index-nested-loop-join.sqllogic +305 -0
- package/test/logic/11.3-mismatched-collation-join.sqllogic +74 -0
- package/test/logic/11.4-hash-join-side-swap.sqllogic +118 -0
- package/test/logic/110-scan-emitter-mutation-kills.sqllogic +121 -0
- package/test/logic/110.1-scan-emitter-index-scan-kills.sqllogic +47 -0
- package/test/logic/12-empty-primary-key.sqllogic +124 -0
- package/test/logic/12-join_padding_order.sqllogic +58 -0
- package/test/logic/12.1-orderby-index-consumption.sqllogic +40 -0
- package/test/logic/13-cte.sqllogic +137 -0
- package/test/logic/13.1-cte-multiple-recursive.sqllogic +104 -0
- package/test/logic/13.10-cte-qualified-name.sqllogic +136 -0
- package/test/logic/13.11-unreferenced-dml-cte.sqllogic +414 -0
- package/test/logic/13.12-nested-dml-cte-rejected.sqllogic +280 -0
- package/test/logic/13.2-cte-bind-params.sqllogic +98 -0
- package/test/logic/13.3-cte-edge-cases.sqllogic +120 -0
- package/test/logic/13.4-cte-extras.sqllogic +98 -0
- package/test/logic/13.5-cte-join-order.sqllogic +166 -0
- package/test/logic/13.6-cte-dml-runs-once.sqllogic +318 -0
- package/test/logic/13.7-cte-sibling-visibility.sqllogic +227 -0
- package/test/logic/13.8-insert-with-clause-visibility.sqllogic +254 -0
- package/test/logic/13.9-schema-authored-cte-isolation.sqllogic +328 -0
- package/test/logic/13.9.1-schema-authored-schema-path-isolation.sqllogic +408 -0
- package/test/logic/14-utilities.sqllogic +168 -0
- package/test/logic/15-timespan.sqllogic +279 -0
- package/test/logic/15.1-semantic-ordering.sqllogic +960 -0
- package/test/logic/15.1.1-json-check-coercion.sqllogic +178 -0
- package/test/logic/15.1.2-semantic-ordering-index.sqllogic +41 -0
- package/test/logic/15.1.3-declared-form-write-contract.sqllogic +519 -0
- package/test/logic/16-epoch.sqllogic +187 -0
- package/test/logic/17-weekday-modifier.sqllogic +78 -0
- package/test/logic/18-json-string-escapes.sqllogic +86 -0
- package/test/logic/18-strftime-extended-formats.sqllogic +68 -0
- package/test/logic/20-empty-single-row.sqllogic +261 -0
- package/test/logic/21-null-edge-cases.sqllogic +227 -0
- package/test/logic/21.1-where-null-comparisons.sqllogic +151 -0
- package/test/logic/21.1.1-where-null-comparisons-secondary-index.sqllogic +35 -0
- package/test/logic/21.2-between-edges.sqllogic +157 -0
- package/test/logic/22-boundary-values.sqllogic +175 -0
- package/test/logic/23-self-joins-duplicates.sqllogic +74 -0
- package/test/logic/24-builtin-branches.sqllogic +611 -0
- package/test/logic/24.1-substr-extras.sqllogic +75 -0
- package/test/logic/24.2-random-extras.sqllogic +39 -0
- package/test/logic/25-aggregate-edge-cases.sqllogic +289 -0
- package/test/logic/25.1-nested-aggregates.sqllogic +74 -0
- package/test/logic/25.2-having-edge-cases.sqllogic +318 -0
- package/test/logic/25.3-aggregate-isnull-empty.sqllogic +16 -0
- package/test/logic/25.4-groupby-fd-constant-empty.sqllogic +55 -0
- package/test/logic/25.5-ungrouped-aggregate-column-free-select-item.sqllogic +196 -0
- package/test/logic/26-join-edge-cases.sqllogic +333 -0
- package/test/logic/26.1-left-join-isnull-on-notnull.sqllogic +26 -0
- package/test/logic/26.2-left-join-on-vs-where.sqllogic +67 -0
- package/test/logic/26.3-join-on-constants.sqllogic +61 -0
- package/test/logic/26.4-join-on-is-null-nullable.sqllogic +44 -0
- package/test/logic/27-window-edge-cases.sqllogic +206 -0
- package/test/logic/27.1-window-groups-frame.sqllogic +13 -0
- package/test/logic/27.2-window-exclude.sqllogic +13 -0
- package/test/logic/27.3-window-json-aggregation.sqllogic +66 -0
- package/test/logic/28-set-ops-sort-edge-cases.sqllogic +444 -0
- package/test/logic/28.1-compound-limit-offset.sqllogic +143 -0
- package/test/logic/28.2-orderby-expression-extras.sqllogic +698 -0
- package/test/logic/28.2-set-op-branch-types.sqllogic +217 -0
- package/test/logic/29-constraint-edge-cases.sqllogic +442 -0
- package/test/logic/29.1-column-level-conflict-clause.sqllogic +171 -0
- package/test/logic/29.2-table-level-pk-conflict-clause.sqllogic +113 -0
- package/test/logic/40-constraints.sqllogic +418 -0
- package/test/logic/40.1-pk-desc-direction.sqllogic +76 -0
- package/test/logic/40.2-check-extras.sqllogic +683 -0
- package/test/logic/41-alter-table.sqllogic +191 -0
- package/test/logic/41-fk-cascade-conflict-and-self-ref.sqllogic +263 -0
- package/test/logic/41-fk-cross-schema.sqllogic +155 -0
- package/test/logic/41-fk-extended-targets.sqllogic +173 -0
- package/test/logic/41-foreign-keys.sqllogic +1001 -0
- package/test/logic/41-generated-column-errors.sqllogic +225 -0
- package/test/logic/41-generated-column-extras.sqllogic +598 -0
- package/test/logic/41-generated-column-scope.sqllogic +329 -0
- package/test/logic/41-generated-columns.sqllogic +361 -0
- package/test/logic/41.1-alter-pk.sqllogic +230 -0
- package/test/logic/41.1-fk-collation-conflict.sqllogic +277 -0
- package/test/logic/41.10-alter-drop-column-foreign-key.sqllogic +274 -0
- package/test/logic/41.10.1-alter-drop-column-unique-index.sqllogic +169 -0
- package/test/logic/41.10.2-alter-drop-column-check-and-assertion.sqllogic +1616 -0
- package/test/logic/41.10.3-alter-drop-column-referencing-fk.sqllogic +292 -0
- package/test/logic/41.10.4-drop-object-expression-dependents.sqllogic +602 -0
- package/test/logic/41.11-deferred-fk-with-rename.sqllogic +232 -0
- package/test/logic/41.12-alter-default-coercion.sqllogic +200 -0
- package/test/logic/41.13-alter-add-column-generated-backfill.sqllogic +566 -0
- package/test/logic/41.14-alter-add-column-subquery-backfill.sqllogic +129 -0
- package/test/logic/41.15-alter-column-default-type-check.sqllogic +178 -0
- package/test/logic/41.16-fk-unenforceable.sqllogic +364 -0
- package/test/logic/41.2-alter-column.sqllogic +382 -0
- package/test/logic/41.2.1-alter-column-retype-deleted-row-memory.sqllogic +32 -0
- package/test/logic/41.2.2-alter-column-retype-index-rebuild.sqllogic +77 -0
- package/test/logic/41.2.3-alter-column-set-not-null-pk-backfill.sqllogic +310 -0
- package/test/logic/41.2.3.1-alter-column-set-not-null-pk-backfill-secondary-index.sqllogic +37 -0
- package/test/logic/41.3-alter-add-column-unique.sqllogic +184 -0
- package/test/logic/41.3-alter-rename-propagation.sqllogic +2352 -0
- package/test/logic/41.3.1-alter-rename-index-propagation.sqllogic +94 -0
- package/test/logic/41.4-alter-add-column-constraints.sqllogic +855 -0
- package/test/logic/41.5-alter-misc.sqllogic +48 -0
- package/test/logic/41.5-cross-schema-foreign-keys.sqllogic +253 -0
- package/test/logic/41.6-alter-drop-rename-constraint.sqllogic +354 -0
- package/test/logic/41.6.1-alter-drop-constraint-index-derived.sqllogic +22 -0
- package/test/logic/41.7-alter-column-collate.sqllogic +105 -0
- package/test/logic/41.7.1-alter-column-collate-unique.sqllogic +45 -0
- package/test/logic/41.7.2-alter-column-collate-unique-store.sqllogic +208 -0
- package/test/logic/41.7.2.1-alter-column-collate-unique-index-store.sqllogic +114 -0
- package/test/logic/41.7.3-alter-column-retype-unique.sqllogic +293 -0
- package/test/logic/41.7.3.1-alter-column-retype-staged-rows-memory.sqllogic +41 -0
- package/test/logic/41.7.3.2-alter-column-retype-unique-index.sqllogic +72 -0
- package/test/logic/41.7.4-alter-column-retype-semantic-memory.sqllogic +445 -0
- package/test/logic/41.7.4.1-alter-column-retype-semantic-index-memory.sqllogic +91 -0
- package/test/logic/41.7.5-alter-column-collate-pk-staged-delete-memory.sqllogic +106 -0
- package/test/logic/41.8-alter-add-constraint-unique-fk.sqllogic +275 -0
- package/test/logic/41.8-alter-savepoint-staged-rows.sqllogic +443 -0
- package/test/logic/41.8.1-alter-rename-savepoint-staged-rows.sqllogic +408 -0
- package/test/logic/41.9-alter-constraint-body-change.sqllogic +180 -0
- package/test/logic/41.9-fk-restrict-batched.sqllogic +290 -0
- package/test/logic/42-committed-snapshot.sqllogic +254 -0
- package/test/logic/42-returning.sqllogic +159 -0
- package/test/logic/42.1-returning-extras.sqllogic +232 -0
- package/test/logic/42.2-returning-stored-row.sqllogic +165 -0
- package/test/logic/43-default-nullability.sqllogic +131 -0
- package/test/logic/43-transition-constraints.sqllogic +341 -0
- package/test/logic/43.1-default-collation.sqllogic +140 -0
- package/test/logic/43.1-notnull-or-conflict.sqllogic +79 -0
- package/test/logic/43.2-deferred-check-new-on-delete.sqllogic +95 -0
- package/test/logic/43.3-nullable-primary-key.sqllogic +587 -0
- package/test/logic/44-determinism-validation.sqllogic +164 -0
- package/test/logic/44-orthogonality.sqllogic +146 -0
- package/test/logic/44.1-nondeterministic-schema.sqllogic +316 -0
- package/test/logic/45-udf-determinism.sqllogic +39 -0
- package/test/logic/46-mutation-context.sqllogic +595 -0
- package/test/logic/47-upsert.sqllogic +255 -0
- package/test/logic/47.1-upsert-conflict-targets.sqllogic +169 -0
- package/test/logic/47.2-replace-and-or-clauses.sqllogic +164 -0
- package/test/logic/47.2.1-pk-replace-secondary-unique.sqllogic +374 -0
- package/test/logic/47.3-engine-or-fail.sqllogic +122 -0
- package/test/logic/47.3-upsert-conflict-target-collation.sqllogic +139 -0
- package/test/logic/47.3.1-upsert-conflict-index-derived-collation.sqllogic +25 -0
- package/test/logic/47.4-upsert-conflict-target-affinity.sqllogic +59 -0
- package/test/logic/47.5-upsert-do-update-constraints.sqllogic +440 -0
- package/test/logic/47.6-upsert-do-update-decomposed.sqllogic +100 -0
- package/test/logic/49-reference-graph.sqllogic +84 -0
- package/test/logic/50-declarative-schema.sqllogic +2550 -0
- package/test/logic/50-metadata-tags.sqllogic +1033 -0
- package/test/logic/50.0.1-metadata-tags-index.sqllogic +141 -0
- package/test/logic/50.1-declare-schema-pk.sqllogic +150 -0
- package/test/logic/50.2-declare-schema-renames.sqllogic +949 -0
- package/test/logic/50.2.1-declare-schema-index-renames.sqllogic +173 -0
- package/test/logic/50.3-declare-schema-duplicate-names.sqllogic +280 -0
- package/test/logic/50.4-declare-schema-apply-restore.sqllogic +192 -0
- package/test/logic/51-lens-foundation.sqllogic +147 -0
- package/test/logic/51-materialized-views.sqllogic +376 -0
- package/test/logic/51.5-materialized-views-coarsened-key.sqllogic +198 -0
- package/test/logic/51.7-maintained-table-attach-detach.sqllogic +468 -0
- package/test/logic/51.8-maintained-table-declared-constraints.sqllogic +440 -0
- package/test/logic/51.85-maintained-table-parent-fk.sqllogic +103 -0
- package/test/logic/51.9-maintained-table-secondary-unique.sqllogic +237 -0
- package/test/logic/51.9.1-maintained-table-partial-unique.sqllogic +36 -0
- package/test/logic/52-lens-overrides.sqllogic +566 -0
- package/test/logic/53-materialized-views-rowtime.sqllogic +1601 -0
- package/test/logic/53-reserved-tags.sqllogic +252 -0
- package/test/logic/53.1-materialized-view-write-through.sqllogic +329 -0
- package/test/logic/53.2-materialized-view-rename-propagation.sqllogic +483 -0
- package/test/logic/53.3-materialized-view-constraint-only-ddl.sqllogic +409 -0
- package/test/logic/53.3.1-materialized-view-index-ddl-irrelevance.sqllogic +29 -0
- package/test/logic/53.4-materialized-view-structural-alter-restore.sqllogic +436 -0
- package/test/logic/54-covering-mv-enforcement.sqllogic +314 -0
- package/test/logic/54.1-covering-mv-partial-enforcement.sqllogic +34 -0
- package/test/logic/55-internal-eviction-reporting.sqllogic +89 -0
- package/test/logic/55-lens-prover.sqllogic +202 -0
- package/test/logic/55.1-eviction-restrict-fk.sqllogic +148 -0
- package/test/logic/55.5-lens-authored-inverse.sqllogic +1468 -0
- package/test/logic/80-grow-retrieve-pass.sqllogic +79 -0
- package/test/logic/81-quickpick.sqllogic +24 -0
- package/test/logic/82-bloom-join.sqllogic +185 -0
- package/test/logic/83-merge-join.sqllogic +280 -0
- package/test/logic/84-asof-scan.sqllogic +238 -0
- package/test/logic/84-key-cardinality.sqllogic +50 -0
- package/test/logic/85-relational-const-folding.sqllogic +51 -0
- package/test/logic/86-scalar-cse.sqllogic +42 -0
- package/test/logic/90-error_paths.sqllogic +114 -0
- package/test/logic/90.1-parse-errors.sqllogic +77 -0
- package/test/logic/90.2-alter-table-errors.sqllogic +53 -0
- package/test/logic/90.2.1-alter-extra-errors.sqllogic +51 -0
- package/test/logic/90.3-expression-errors.sqllogic +43 -0
- package/test/logic/90.4-dml-errors.sqllogic +47 -0
- package/test/logic/90.5-unsupported-join-types.sqllogic +37 -0
- package/test/logic/90.5.1-right-full-join-read.sqllogic +157 -0
- package/test/logic/90.6-select-error-paths.sqllogic +57 -0
- package/test/logic/91-merge-join-edge-cases.sqllogic +159 -0
- package/test/logic/92-hash-aggregate-edge-cases.sqllogic +139 -0
- package/test/logic/93-ddl-view-edge-cases.sqllogic +104 -0
- package/test/logic/93.1-view-error-paths.sqllogic +74 -0
- package/test/logic/93.2-view-mutation-pending.sqllogic +108 -0
- package/test/logic/93.3-view-mutation-or-clause.sqllogic +60 -0
- package/test/logic/93.4-view-mutation.sqllogic +4881 -0
- package/test/logic/93.4.1-view-mutation-partial-unique-cardinality.sqllogic +31 -0
- package/test/logic/93.5-authored-inverse.sqllogic +415 -0
- package/test/logic/93.6-set-op-flagless-write.sqllogic +862 -0
- package/test/logic/94-tvf-edge-cases.sqllogic +58 -0
- package/test/logic/94.1-limit-offset-edge-cases.sqllogic +109 -0
- package/test/logic/94.2-limit-offset-extras.sqllogic +98 -0
- package/test/logic/95-assertions.sqllogic +1417 -0
- package/test/logic/96-subquery-edge-cases.sqllogic +276 -0
- package/test/logic/97-json-function-edge-cases.sqllogic +633 -0
- package/test/logic/97.1-json-blob-and-special-values.sqllogic +92 -0
- package/test/logic/98-temporal-edge-cases.sqllogic +515 -0
- package/test/logic/99-conversion-edge-cases.sqllogic +325 -0
- package/test/logic/99.0.1-schema-index-listing.sqllogic +21 -0
- package/test/logic/99.1-cast-syntax-extras.sqllogic +167 -0
- package/test/logic/drop-unique-index.sqllogic +88 -0
- package/test/logic/pushdown-test.sqllogic +36 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
-- Row-validating DDL inside an open transaction.
|
|
2
|
+
--
|
|
3
|
+
-- `create unique index` and `alter table ... add constraint ... unique` must see the
|
|
4
|
+
-- rows the issuing transaction has written but not yet committed, and the constraint
|
|
5
|
+
-- they declare must stay enforced for the rest of that transaction.
|
|
6
|
+
--
|
|
7
|
+
-- Runs against every backend (memory, store). Each statement is its own block so an
|
|
8
|
+
-- expected failure is attributed to exactly one statement.
|
|
9
|
+
--
|
|
10
|
+
-- requires-capability: standalone-index-ddl
|
|
11
|
+
--
|
|
12
|
+
-- The `alter table ... add constraint ... unique` twins of §1 and §4 need no index DDL at all,
|
|
13
|
+
-- so they live in 10.1.2.1-add-constraint-in-transaction and run on every backend. Everything
|
|
14
|
+
-- left here builds the constraint through `create unique index`.
|
|
15
|
+
|
|
16
|
+
-- ===================================
|
|
17
|
+
-- 1. create unique index over rows the transaction just inserted
|
|
18
|
+
-- ===================================
|
|
19
|
+
|
|
20
|
+
create table ddl_tx_a (id integer primary key, v text);
|
|
21
|
+
-- run
|
|
22
|
+
begin;
|
|
23
|
+
-- run
|
|
24
|
+
insert into ddl_tx_a values (1, 'a');
|
|
25
|
+
-- run
|
|
26
|
+
insert into ddl_tx_a values (2, 'a');
|
|
27
|
+
-- run
|
|
28
|
+
create unique index ddl_tx_a_ix on ddl_tx_a (v);
|
|
29
|
+
-- error: UNIQUE constraint failed
|
|
30
|
+
rollback;
|
|
31
|
+
-- run
|
|
32
|
+
|
|
33
|
+
-- The rejected transaction left nothing behind.
|
|
34
|
+
select count(*) as cnt from ddl_tx_a;
|
|
35
|
+
→ [{ "cnt": 0 }]
|
|
36
|
+
|
|
37
|
+
-- ===================================
|
|
38
|
+
-- 2. create unique index over a pending row colliding with a committed one
|
|
39
|
+
-- ===================================
|
|
40
|
+
|
|
41
|
+
insert into ddl_tx_a values (1, 'a');
|
|
42
|
+
-- run
|
|
43
|
+
begin;
|
|
44
|
+
-- run
|
|
45
|
+
insert into ddl_tx_a values (2, 'a');
|
|
46
|
+
-- run
|
|
47
|
+
create unique index ddl_tx_a_ix on ddl_tx_a (v);
|
|
48
|
+
-- error: UNIQUE constraint failed
|
|
49
|
+
rollback;
|
|
50
|
+
-- run
|
|
51
|
+
|
|
52
|
+
select count(*) as cnt from ddl_tx_a;
|
|
53
|
+
→ [{ "cnt": 1 }]
|
|
54
|
+
|
|
55
|
+
-- ===================================
|
|
56
|
+
-- 3. add constraint ... unique over rows the transaction just inserted
|
|
57
|
+
-- ===================================
|
|
58
|
+
-- Lives in 10.1.2.1-add-constraint-in-transaction § 1 (it needs no index DDL).
|
|
59
|
+
|
|
60
|
+
-- ===================================
|
|
61
|
+
-- 4. Accepted DDL enforces the new constraint for the rest of the transaction
|
|
62
|
+
-- ===================================
|
|
63
|
+
|
|
64
|
+
create table ddl_tx_c (id integer primary key, v text);
|
|
65
|
+
-- run
|
|
66
|
+
begin;
|
|
67
|
+
-- run
|
|
68
|
+
insert into ddl_tx_c values (1, 'a');
|
|
69
|
+
-- run
|
|
70
|
+
create unique index ddl_tx_c_ix on ddl_tx_c (v);
|
|
71
|
+
-- run
|
|
72
|
+
insert into ddl_tx_c values (2, 'a');
|
|
73
|
+
-- error: UNIQUE constraint failed
|
|
74
|
+
|
|
75
|
+
-- The transaction is still open; a non-colliding row is accepted and commits.
|
|
76
|
+
insert into ddl_tx_c values (3, 'b');
|
|
77
|
+
-- run
|
|
78
|
+
commit;
|
|
79
|
+
-- run
|
|
80
|
+
|
|
81
|
+
select id, v from ddl_tx_c order by id;
|
|
82
|
+
→ [{ "id": 1, "v": "a" }, { "id": 3, "v": "b" }]
|
|
83
|
+
|
|
84
|
+
-- The committed index still enforces uniqueness.
|
|
85
|
+
insert into ddl_tx_c values (4, 'b');
|
|
86
|
+
-- error: UNIQUE constraint failed
|
|
87
|
+
|
|
88
|
+
-- ===================================
|
|
89
|
+
-- 5. Same, through add constraint ... unique
|
|
90
|
+
-- ===================================
|
|
91
|
+
-- Lives in 10.1.2.1-add-constraint-in-transaction § 2 (it needs no index DDL).
|
|
92
|
+
|
|
93
|
+
-- ===================================
|
|
94
|
+
-- 6. A pending DELETE removes a committed duplicate, so the build is legal
|
|
95
|
+
-- ===================================
|
|
96
|
+
|
|
97
|
+
create table ddl_tx_e (id integer primary key, v text);
|
|
98
|
+
-- run
|
|
99
|
+
insert into ddl_tx_e values (1, 'a');
|
|
100
|
+
-- run
|
|
101
|
+
insert into ddl_tx_e values (2, 'a');
|
|
102
|
+
-- run
|
|
103
|
+
begin;
|
|
104
|
+
-- run
|
|
105
|
+
delete from ddl_tx_e where id = 2;
|
|
106
|
+
-- run
|
|
107
|
+
create unique index ddl_tx_e_ix on ddl_tx_e (v);
|
|
108
|
+
-- run
|
|
109
|
+
commit;
|
|
110
|
+
-- run
|
|
111
|
+
|
|
112
|
+
select id, v from ddl_tx_e order by id;
|
|
113
|
+
→ [{ "id": 1, "v": "a" }]
|
|
114
|
+
|
|
115
|
+
-- ===================================
|
|
116
|
+
-- 7. NULLs are distinct: multiple pending NULLs never block the build
|
|
117
|
+
-- ===================================
|
|
118
|
+
|
|
119
|
+
create table ddl_tx_f (id integer primary key, v text null);
|
|
120
|
+
-- run
|
|
121
|
+
begin;
|
|
122
|
+
-- run
|
|
123
|
+
insert into ddl_tx_f values (1, null);
|
|
124
|
+
-- run
|
|
125
|
+
insert into ddl_tx_f values (2, null);
|
|
126
|
+
-- run
|
|
127
|
+
create unique index ddl_tx_f_ix on ddl_tx_f (v);
|
|
128
|
+
-- run
|
|
129
|
+
commit;
|
|
130
|
+
-- run
|
|
131
|
+
|
|
132
|
+
select count(*) as cnt from ddl_tx_f;
|
|
133
|
+
→ [{ "cnt": 2 }]
|
|
134
|
+
|
|
135
|
+
-- Cleanup
|
|
136
|
+
drop table ddl_tx_a;
|
|
137
|
+
-- run
|
|
138
|
+
drop table ddl_tx_c;
|
|
139
|
+
-- run
|
|
140
|
+
drop table ddl_tx_e;
|
|
141
|
+
-- run
|
|
142
|
+
drop table ddl_tx_f;
|
|
143
|
+
-- run
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
-- Adding a UNIQUE constraint inside an open transaction must see the rows that transaction
|
|
2
|
+
-- has written but not yet committed, and must stay enforced for the rest of it.
|
|
3
|
+
--
|
|
4
|
+
-- Carved out of 10.1.2-ddl-in-transaction, which is annotated
|
|
5
|
+
-- `requires-capability: standalone-index-ddl` because its subject is `create unique index`.
|
|
6
|
+
-- These two sections are the constraint-side twins of that file's § 1 and § 4 and use no
|
|
7
|
+
-- index DDL, so a backend skipping 10.1.2 would have lost them for no reason.
|
|
8
|
+
--
|
|
9
|
+
-- Runs against every backend (memory, store). Each statement is its own block so an
|
|
10
|
+
-- expected failure is attributed to exactly one statement.
|
|
11
|
+
|
|
12
|
+
-- ===================================
|
|
13
|
+
-- 1. add constraint ... unique over rows the transaction just inserted
|
|
14
|
+
-- ===================================
|
|
15
|
+
|
|
16
|
+
create table ddl_tx_b (id integer primary key, v text);
|
|
17
|
+
-- run
|
|
18
|
+
begin;
|
|
19
|
+
-- run
|
|
20
|
+
insert into ddl_tx_b values (1, 'a');
|
|
21
|
+
-- run
|
|
22
|
+
insert into ddl_tx_b values (2, 'a');
|
|
23
|
+
-- run
|
|
24
|
+
alter table ddl_tx_b add constraint ddl_tx_b_u unique (v);
|
|
25
|
+
-- error: UNIQUE constraint failed
|
|
26
|
+
rollback;
|
|
27
|
+
-- run
|
|
28
|
+
|
|
29
|
+
-- The rejected transaction left nothing behind.
|
|
30
|
+
select count(*) as cnt from ddl_tx_b;
|
|
31
|
+
→ [{ "cnt": 0 }]
|
|
32
|
+
|
|
33
|
+
-- ===================================
|
|
34
|
+
-- 2. An accepted add constraint enforces for the rest of the transaction
|
|
35
|
+
-- ===================================
|
|
36
|
+
|
|
37
|
+
create table ddl_tx_d (id integer primary key, v text);
|
|
38
|
+
-- run
|
|
39
|
+
begin;
|
|
40
|
+
-- run
|
|
41
|
+
insert into ddl_tx_d values (1, 'a');
|
|
42
|
+
-- run
|
|
43
|
+
alter table ddl_tx_d add constraint ddl_tx_d_u unique (v);
|
|
44
|
+
-- run
|
|
45
|
+
insert into ddl_tx_d values (2, 'a');
|
|
46
|
+
-- error: UNIQUE constraint failed
|
|
47
|
+
insert into ddl_tx_d values (3, 'b');
|
|
48
|
+
-- run
|
|
49
|
+
commit;
|
|
50
|
+
-- run
|
|
51
|
+
|
|
52
|
+
select id, v from ddl_tx_d order by id;
|
|
53
|
+
→ [{ "id": 1, "v": "a" }, { "id": 3, "v": "b" }]
|
|
54
|
+
|
|
55
|
+
-- Cleanup
|
|
56
|
+
drop table ddl_tx_b;
|
|
57
|
+
-- run
|
|
58
|
+
drop table ddl_tx_d;
|
|
59
|
+
-- run
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
-- Dropping a UNIQUE index / constraint inside an open transaction must stop enforcing it
|
|
2
|
+
-- for the rest of that transaction.
|
|
3
|
+
--
|
|
4
|
+
-- requires-capability: standalone-index-ddl
|
|
5
|
+
--
|
|
6
|
+
-- A `TransactionLayer` freezes its schema at construction and enforces UNIQUE off that frozen
|
|
7
|
+
-- schema, so a `drop index` / `alter table … drop constraint` that ran after the layer forked
|
|
8
|
+
-- used to keep rejecting rows against a constraint that no longer exists. The manager now hands
|
|
9
|
+
-- the post-drop schema to every open layer (`adoptSchemaOnOpenLayers` → `TransactionLayer.adoptSchema`,
|
|
10
|
+
-- which now also removes the dropped index), so enforcement stops immediately.
|
|
11
|
+
--
|
|
12
|
+
-- § 4 additionally pins the savepoint interaction, which is cross-backend on both counts: a
|
|
13
|
+
-- `rollback to savepoint` keeps every row staged BEFORE the savepoint, and does NOT undo the
|
|
14
|
+
-- DROP itself (DDL is not transactional on either backend).
|
|
15
|
+
--
|
|
16
|
+
-- Runs against every backend (memory, store). Each statement is its own block so an expected
|
|
17
|
+
-- failure is attributed to exactly one statement.
|
|
18
|
+
|
|
19
|
+
-- ===================================
|
|
20
|
+
-- 1. drop index on a unique index inside a transaction stops enforcing it
|
|
21
|
+
-- ===================================
|
|
22
|
+
|
|
23
|
+
create table drop_tx_a (id integer primary key, v text);
|
|
24
|
+
-- run
|
|
25
|
+
create unique index drop_tx_a_ix on drop_tx_a (v);
|
|
26
|
+
-- run
|
|
27
|
+
begin;
|
|
28
|
+
-- run
|
|
29
|
+
insert into drop_tx_a values (1, 'a');
|
|
30
|
+
-- run
|
|
31
|
+
drop index drop_tx_a_ix;
|
|
32
|
+
-- run
|
|
33
|
+
|
|
34
|
+
-- The unique index is gone, so a colliding row is now accepted mid-transaction.
|
|
35
|
+
insert into drop_tx_a values (2, 'a');
|
|
36
|
+
-- run
|
|
37
|
+
commit;
|
|
38
|
+
-- run
|
|
39
|
+
|
|
40
|
+
select id, v from drop_tx_a order by id;
|
|
41
|
+
→ [{ "id": 1, "v": "a" }, { "id": 2, "v": "a" }]
|
|
42
|
+
|
|
43
|
+
-- After commit the constraint is genuinely gone: a fresh duplicate is still accepted.
|
|
44
|
+
insert into drop_tx_a values (3, 'a');
|
|
45
|
+
-- run
|
|
46
|
+
|
|
47
|
+
select count(*) as cnt from drop_tx_a;
|
|
48
|
+
→ [{ "cnt": 3 }]
|
|
49
|
+
|
|
50
|
+
-- ===================================
|
|
51
|
+
-- 2. alter table … drop constraint unique inside a transaction stops enforcing it
|
|
52
|
+
-- ===================================
|
|
53
|
+
-- The constraint-side twin of § 1 needs no index DDL, so it lives in
|
|
54
|
+
-- 10.1.3.1-drop-constraint-in-transaction and stays runnable on backends that skip
|
|
55
|
+
-- this file.
|
|
56
|
+
|
|
57
|
+
-- ===================================
|
|
58
|
+
-- 3. Dropping one unique index leaves a sibling unique index still enforced
|
|
59
|
+
-- ===================================
|
|
60
|
+
|
|
61
|
+
create table drop_tx_c (id integer primary key, v text, w text);
|
|
62
|
+
-- run
|
|
63
|
+
create unique index drop_tx_c_v on drop_tx_c (v);
|
|
64
|
+
-- run
|
|
65
|
+
create unique index drop_tx_c_w on drop_tx_c (w);
|
|
66
|
+
-- run
|
|
67
|
+
begin;
|
|
68
|
+
-- run
|
|
69
|
+
insert into drop_tx_c values (1, 'a', 'x');
|
|
70
|
+
-- run
|
|
71
|
+
drop index drop_tx_c_v;
|
|
72
|
+
-- run
|
|
73
|
+
|
|
74
|
+
-- The dropped index no longer blocks a duplicate v.
|
|
75
|
+
insert into drop_tx_c values (2, 'a', 'y');
|
|
76
|
+
-- run
|
|
77
|
+
|
|
78
|
+
-- The sibling index on w is untouched and still rejects a duplicate w.
|
|
79
|
+
insert into drop_tx_c values (3, 'b', 'x');
|
|
80
|
+
-- error: UNIQUE constraint failed
|
|
81
|
+
commit;
|
|
82
|
+
-- run
|
|
83
|
+
|
|
84
|
+
select id, v, w from drop_tx_c order by id;
|
|
85
|
+
→ [{ "id": 1, "v": "a", "w": "x" }, { "id": 2, "v": "a", "w": "y" }]
|
|
86
|
+
|
|
87
|
+
-- ===================================
|
|
88
|
+
-- 4. index DDL inside a savepoint must not discard writes staged BEFORE the savepoint
|
|
89
|
+
-- ===================================
|
|
90
|
+
-- `rollback to savepoint s` unwinds only what happened after `s`. The isolation layer used to
|
|
91
|
+
-- throw its staging overlay away and copy the staged rows into a fresh one on CREATE/DROP INDEX;
|
|
92
|
+
-- the copy's first write lazily registered a connection, which replays the active savepoint
|
|
93
|
+
-- stack BEFORE the copy — so every copied row landed above `s` and was discarded here. Silent
|
|
94
|
+
-- data loss (bug-isolation-index-ddl-rebuild-drops-savepoint-writes).
|
|
95
|
+
|
|
96
|
+
create table drop_sp_a (id integer primary key, v text);
|
|
97
|
+
-- run
|
|
98
|
+
create unique index drop_sp_a_ix on drop_sp_a (v);
|
|
99
|
+
-- run
|
|
100
|
+
begin;
|
|
101
|
+
-- run
|
|
102
|
+
insert into drop_sp_a values (1, 'a');
|
|
103
|
+
-- run
|
|
104
|
+
savepoint s;
|
|
105
|
+
-- run
|
|
106
|
+
|
|
107
|
+
-- Staged AFTER the savepoint: these two must go.
|
|
108
|
+
insert into drop_sp_a values (2, 'b');
|
|
109
|
+
-- run
|
|
110
|
+
drop index drop_sp_a_ix;
|
|
111
|
+
-- run
|
|
112
|
+
insert into drop_sp_a values (3, 'c');
|
|
113
|
+
-- run
|
|
114
|
+
rollback to savepoint s;
|
|
115
|
+
-- run
|
|
116
|
+
|
|
117
|
+
-- Pre-savepoint row kept, post-savepoint rows discarded — both directions.
|
|
118
|
+
select id, v from drop_sp_a order by id;
|
|
119
|
+
→ [{ "id": 1, "v": "a" }]
|
|
120
|
+
|
|
121
|
+
-- DDL is not transactional on either backend, so `rollback to savepoint` does NOT undo the
|
|
122
|
+
-- DROP: a would-be duplicate is still accepted. Making DDL reversible belongs to the larger
|
|
123
|
+
-- feature `feat-ddl-transaction-capability`.
|
|
124
|
+
insert into drop_sp_a values (4, 'a');
|
|
125
|
+
-- run
|
|
126
|
+
commit;
|
|
127
|
+
-- run
|
|
128
|
+
|
|
129
|
+
select id, v from drop_sp_a order by id;
|
|
130
|
+
→ [{ "id": 1, "v": "a" }, { "id": 4, "v": "a" }]
|
|
131
|
+
|
|
132
|
+
-- Same for the additive direction: CREATE INDEX under a savepoint.
|
|
133
|
+
create table drop_sp_b (id integer primary key, v text);
|
|
134
|
+
-- run
|
|
135
|
+
begin;
|
|
136
|
+
-- run
|
|
137
|
+
insert into drop_sp_b values (1, 'a');
|
|
138
|
+
-- run
|
|
139
|
+
savepoint s2;
|
|
140
|
+
-- run
|
|
141
|
+
create unique index drop_sp_b_ix on drop_sp_b (v);
|
|
142
|
+
-- run
|
|
143
|
+
rollback to savepoint s2;
|
|
144
|
+
-- run
|
|
145
|
+
|
|
146
|
+
select id, v from drop_sp_b order by id;
|
|
147
|
+
→ [{ "id": 1, "v": "a" }]
|
|
148
|
+
commit;
|
|
149
|
+
-- run
|
|
150
|
+
|
|
151
|
+
select id, v from drop_sp_b order by id;
|
|
152
|
+
→ [{ "id": 1, "v": "a" }]
|
|
153
|
+
|
|
154
|
+
-- A tombstone staged before the savepoint survives the DDL too: the DELETE still lands.
|
|
155
|
+
create table drop_sp_c (id integer primary key, v text);
|
|
156
|
+
-- run
|
|
157
|
+
insert into drop_sp_c values (1, 'a'), (2, 'b');
|
|
158
|
+
-- run
|
|
159
|
+
create unique index drop_sp_c_ix on drop_sp_c (v);
|
|
160
|
+
-- run
|
|
161
|
+
begin;
|
|
162
|
+
-- run
|
|
163
|
+
delete from drop_sp_c where id = 1;
|
|
164
|
+
-- run
|
|
165
|
+
savepoint s3;
|
|
166
|
+
-- run
|
|
167
|
+
drop index drop_sp_c_ix;
|
|
168
|
+
-- run
|
|
169
|
+
rollback to savepoint s3;
|
|
170
|
+
-- run
|
|
171
|
+
commit;
|
|
172
|
+
-- run
|
|
173
|
+
|
|
174
|
+
select id, v from drop_sp_c order by id;
|
|
175
|
+
→ [{ "id": 2, "v": "b" }]
|
|
176
|
+
|
|
177
|
+
-- Cleanup
|
|
178
|
+
drop table drop_tx_a;
|
|
179
|
+
-- run
|
|
180
|
+
drop table drop_tx_c;
|
|
181
|
+
-- run
|
|
182
|
+
drop table drop_sp_a;
|
|
183
|
+
-- run
|
|
184
|
+
drop table drop_sp_b;
|
|
185
|
+
-- run
|
|
186
|
+
drop table drop_sp_c;
|
|
187
|
+
-- run
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
-- Dropping a UNIQUE constraint inside an open transaction must stop enforcing it for the
|
|
2
|
+
-- rest of that transaction.
|
|
3
|
+
--
|
|
4
|
+
-- Carved out of 10.1.3-ddl-drop-in-transaction, which is annotated
|
|
5
|
+
-- `requires-capability: standalone-index-ddl` because most of it drops UNIQUE INDEXES.
|
|
6
|
+
-- This section is the constraint-side twin of that file's § 1 and uses no index DDL, so a
|
|
7
|
+
-- backend skipping 10.1.3 would have lost it for no reason.
|
|
8
|
+
--
|
|
9
|
+
-- A `TransactionLayer` freezes its schema at construction and enforces UNIQUE off that frozen
|
|
10
|
+
-- schema, so an `alter table … drop constraint` that ran after the layer forked used to keep
|
|
11
|
+
-- rejecting rows against a constraint that no longer exists. The manager now hands the
|
|
12
|
+
-- post-drop schema to every open layer (`adoptSchemaOnOpenLayers` → `TransactionLayer.adoptSchema`),
|
|
13
|
+
-- so enforcement stops immediately.
|
|
14
|
+
--
|
|
15
|
+
-- Runs against every backend (memory, store). Each statement is its own block so an expected
|
|
16
|
+
-- failure is attributed to exactly one statement.
|
|
17
|
+
|
|
18
|
+
-- ===================================
|
|
19
|
+
-- alter table … drop constraint unique inside a transaction stops enforcing it
|
|
20
|
+
-- ===================================
|
|
21
|
+
|
|
22
|
+
create table drop_tx_b (id integer primary key, v text, constraint drop_tx_b_u unique (v));
|
|
23
|
+
-- run
|
|
24
|
+
begin;
|
|
25
|
+
-- run
|
|
26
|
+
insert into drop_tx_b values (1, 'a');
|
|
27
|
+
-- run
|
|
28
|
+
alter table drop_tx_b drop constraint drop_tx_b_u;
|
|
29
|
+
-- run
|
|
30
|
+
|
|
31
|
+
-- The unique constraint is gone, so a colliding row is now accepted mid-transaction.
|
|
32
|
+
insert into drop_tx_b values (2, 'a');
|
|
33
|
+
-- run
|
|
34
|
+
commit;
|
|
35
|
+
-- run
|
|
36
|
+
|
|
37
|
+
select id, v from drop_tx_b order by id;
|
|
38
|
+
→ [{ "id": 1, "v": "a" }, { "id": 2, "v": "a" }]
|
|
39
|
+
|
|
40
|
+
-- After commit the constraint is genuinely gone: a fresh duplicate is still accepted.
|
|
41
|
+
insert into drop_tx_b values (3, 'a');
|
|
42
|
+
-- run
|
|
43
|
+
|
|
44
|
+
select count(*) as cnt from drop_tx_b;
|
|
45
|
+
→ [{ "cnt": 3 }]
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
-- CREATE TABLE constraint-name uniqueness and minted-name disambiguation.
|
|
2
|
+
--
|
|
3
|
+
-- One constraint name must address exactly one constraint on a table. Two arms:
|
|
4
|
+
--
|
|
5
|
+
-- 1. USER-WRITTEN names: a CREATE TABLE declaring two constraints under one
|
|
6
|
+
-- (case-folded) name is refused outright — the same within-table rule every
|
|
7
|
+
-- ALTER path enforces via assertConstraintNameFree, applied at birth
|
|
8
|
+
-- (assertNoDuplicateConstraintNames, schema/catalog.ts). One name space
|
|
9
|
+
-- across CHECK / UNIQUE / FOREIGN KEY: a same-class collision makes DROP
|
|
10
|
+
-- CONSTRAINT remove both, and a cross-class collision is permanently
|
|
11
|
+
-- un-droppable (resolveNamedConstraintClass reports it ambiguous forever).
|
|
12
|
+
--
|
|
13
|
+
-- 2. ENGINE-MINTED names (`_check_<col>`, `_fk_<table>_<cols>`): the colliding
|
|
14
|
+
-- declaration is LEGAL (two unnamed CHECKs on one column; two FKs on one
|
|
15
|
+
-- child column into different parents), so the mint disambiguates instead of
|
|
16
|
+
-- rejecting: the first occurrence keeps the base name, the Nth gets `_<N>`
|
|
17
|
+
-- (disambiguateAutoConstraintName, schema/table.ts). Every non-colliding
|
|
18
|
+
-- mint stays byte-identical to before — 41.10.3 and 03.4 pin that.
|
|
19
|
+
--
|
|
20
|
+
-- No `-- requires-capability:` directive, so this runs under both the memory
|
|
21
|
+
-- module and the store module. The store leg matters: disambiguated names are
|
|
22
|
+
-- persisted and must survive a reopen.
|
|
23
|
+
|
|
24
|
+
pragma foreign_keys = true;
|
|
25
|
+
|
|
26
|
+
-- ===================================================================
|
|
27
|
+
-- 1. User-written duplicate names are refused at CREATE TABLE
|
|
28
|
+
-- ===================================================================
|
|
29
|
+
|
|
30
|
+
-- 1a. Exact duplicate, same class.
|
|
31
|
+
create table Dup1 (id integer primary key, a integer, b integer, constraint z unique (a), constraint z unique (b));
|
|
32
|
+
-- error: duplicate constraint name 'z'
|
|
33
|
+
|
|
34
|
+
-- 1b. Case-differing spellings are one name (identifier semantics).
|
|
35
|
+
create table Dup2 (id integer primary key, a integer, b integer, constraint q unique (a), constraint Q unique (b));
|
|
36
|
+
-- error: duplicate constraint name
|
|
37
|
+
|
|
38
|
+
-- 1c. Cross-class (UNIQUE vs FOREIGN KEY) — the un-droppable-forever shape.
|
|
39
|
+
create table NPar (pid integer primary key, r integer unique);
|
|
40
|
+
create table Dup3 (id integer primary key, a integer, constraint n unique (a), constraint n foreign key (a) references NPar(r));
|
|
41
|
+
-- error: duplicate constraint name 'n'
|
|
42
|
+
|
|
43
|
+
-- 1d. Cross-class (CHECK vs UNIQUE), column-level vs table-level declaration.
|
|
44
|
+
create table Dup4 (id integer primary key, a integer constraint w check (a > 0), constraint W unique (a));
|
|
45
|
+
-- error: duplicate constraint name
|
|
46
|
+
|
|
47
|
+
-- None of the refused tables were created.
|
|
48
|
+
select count(*) as c from schema() where type = 'table' and name like 'Dup%';
|
|
49
|
+
→ [{"c":0}]
|
|
50
|
+
|
|
51
|
+
-- Distinct names on the same shapes are accepted (positive control).
|
|
52
|
+
create table DOk (id integer primary key, a integer, b integer, constraint u1 unique (a), constraint u2 unique (b));
|
|
53
|
+
drop table DOk;
|
|
54
|
+
|
|
55
|
+
-- ===================================================================
|
|
56
|
+
-- 2. Two unnamed FKs on one child column (different parents): minted
|
|
57
|
+
-- `_fk_FkC_x` and `_fk_FkC_x_2`, each addressable, each dropping only itself
|
|
58
|
+
-- ===================================================================
|
|
59
|
+
|
|
60
|
+
create table FkP1 (x integer primary key);
|
|
61
|
+
create table FkP2 (y integer primary key);
|
|
62
|
+
create table FkC (id integer primary key, x integer null, foreign key (x) references FkP1(x), foreign key (x) references FkP2(y));
|
|
63
|
+
|
|
64
|
+
select name, "to" from foreign_key_info('FkC') order by name;
|
|
65
|
+
→ [{"name":"_fk_FkC_x","to":"x"},{"name":"_fk_FkC_x_2","to":"y"}]
|
|
66
|
+
|
|
67
|
+
-- Both keys enforce, each under its own name (FK existence checks share the
|
|
68
|
+
-- `CHECK constraint failed:` prefix — see runtime/row-constraints.ts).
|
|
69
|
+
-- A value present in FkP1 but not FkP2 trips only the second key…
|
|
70
|
+
insert into FkP1 values (1);
|
|
71
|
+
insert into FkC values (1, 1);
|
|
72
|
+
-- error: CHECK constraint failed: _fk_FkC_x_2
|
|
73
|
+
|
|
74
|
+
-- …a value present in FkP2 but not FkP1 trips only the first…
|
|
75
|
+
insert into FkP2 values (2);
|
|
76
|
+
insert into FkC values (1, 2);
|
|
77
|
+
-- error: CHECK constraint failed: _fk_FkC_x
|
|
78
|
+
|
|
79
|
+
-- …and a value present in both parents is accepted.
|
|
80
|
+
insert into FkP2 values (7);
|
|
81
|
+
insert into FkP1 values (7);
|
|
82
|
+
insert into FkC values (1, 7);
|
|
83
|
+
select count(*) as c from FkC;
|
|
84
|
+
→ [{"c":1}]
|
|
85
|
+
|
|
86
|
+
-- Dropping the first key removes ONLY it (the original defect removed both).
|
|
87
|
+
alter table FkC drop constraint _fk_FkC_x;
|
|
88
|
+
select name from foreign_key_info('FkC');
|
|
89
|
+
→ [{"name":"_fk_FkC_x_2"}]
|
|
90
|
+
|
|
91
|
+
-- The surviving key still enforces (1 ∉ FkP2)…
|
|
92
|
+
insert into FkC values (2, 1);
|
|
93
|
+
-- error: CHECK constraint failed: _fk_FkC_x_2
|
|
94
|
+
|
|
95
|
+
-- …while a value only FkP2 holds is now accepted (the dropped key no longer binds).
|
|
96
|
+
insert into FkP2 values (9);
|
|
97
|
+
insert into FkC values (3, 9);
|
|
98
|
+
select count(*) as c from FkC;
|
|
99
|
+
→ [{"c":2}]
|
|
100
|
+
|
|
101
|
+
-- And the survivor is itself addressable by its disambiguated name.
|
|
102
|
+
alter table FkC drop constraint _fk_FkC_x_2;
|
|
103
|
+
select count(*) as c from foreign_key_info('FkC');
|
|
104
|
+
→ [{"c":0}]
|
|
105
|
+
insert into FkC values (4, 12345);
|
|
106
|
+
select count(*) as c from FkC;
|
|
107
|
+
→ [{"c":3}]
|
|
108
|
+
|
|
109
|
+
-- ===================================================================
|
|
110
|
+
-- 3. Two unnamed CHECKs on one column: minted `_check_b` and `_check_b_2`,
|
|
111
|
+
-- both enforced, each individually droppable
|
|
112
|
+
-- ===================================================================
|
|
113
|
+
|
|
114
|
+
create table Ck (id integer primary key, b integer null check (b > 0) check (b < 10));
|
|
115
|
+
insert into Ck values (1, 5);
|
|
116
|
+
|
|
117
|
+
insert into Ck values (2, -1);
|
|
118
|
+
-- error: _check_b (b > 0)
|
|
119
|
+
|
|
120
|
+
insert into Ck values (2, 99);
|
|
121
|
+
-- error: _check_b_2 (b < 10)
|
|
122
|
+
|
|
123
|
+
-- Dropping `_check_b` removes only the lower bound; the upper bound survives.
|
|
124
|
+
alter table Ck drop constraint _check_b;
|
|
125
|
+
insert into Ck values (3, -1);
|
|
126
|
+
insert into Ck values (4, 99);
|
|
127
|
+
-- error: _check_b_2 (b < 10)
|
|
128
|
+
|
|
129
|
+
alter table Ck drop constraint _check_b_2;
|
|
130
|
+
insert into Ck values (5, 99);
|
|
131
|
+
select count(*) as c from Ck;
|
|
132
|
+
→ [{"c":3}]
|
|
133
|
+
|
|
134
|
+
-- ===================================================================
|
|
135
|
+
-- 4. A mint never collides with a name the user typed: the user claims
|
|
136
|
+
-- `_check_b`, so the unnamed CHECK on the same column mints `_check_b_2`
|
|
137
|
+
-- ===================================================================
|
|
138
|
+
|
|
139
|
+
create table MintU (id integer primary key, b integer null constraint _check_b check (b < 10) check (b > 0));
|
|
140
|
+
insert into MintU values (1, -1);
|
|
141
|
+
-- error: _check_b_2 (b > 0)
|
|
142
|
+
|
|
143
|
+
-- ===================================================================
|
|
144
|
+
-- 5. A non-colliding mint is unchanged (pins the compatibility property)
|
|
145
|
+
-- ===================================================================
|
|
146
|
+
|
|
147
|
+
create table Solo (id integer primary key, b integer null check (b > 0));
|
|
148
|
+
insert into Solo values (1, -1);
|
|
149
|
+
-- error: _check_b (b > 0)
|