@quereus/quereus 4.20.0 → 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/dist/src/common/types.d.ts +4 -4
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/schema/catalog-rendering.js +13 -1
- package/dist/src/schema/catalog-rendering.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +35 -2
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +42 -33
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts +1 -1
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +195 -33
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/unique-enforcement.d.ts +23 -1
- package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
- package/dist/src/schema/unique-enforcement.js +43 -1
- package/dist/src/schema/unique-enforcement.js.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +15 -12
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +87 -100
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- 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,247 @@
|
|
|
1
|
+
-- function-features.sqllogic - Testing function registration, usage patterns, and edge cases
|
|
2
|
+
|
|
3
|
+
-- ============================================================
|
|
4
|
+
-- Section 1: Aggregate vs scalar function behavior
|
|
5
|
+
-- ============================================================
|
|
6
|
+
|
|
7
|
+
create table items (
|
|
8
|
+
id integer primary key,
|
|
9
|
+
category text,
|
|
10
|
+
name text,
|
|
11
|
+
price numeric null
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
insert into items values
|
|
15
|
+
(1, 'fruit', 'Apple', 1.50),
|
|
16
|
+
(2, 'fruit', 'Banana', 0.75),
|
|
17
|
+
(3, 'veggie', 'Carrot', 2.00),
|
|
18
|
+
(4, 'veggie', 'Daikon', 3.25),
|
|
19
|
+
(5, 'fruit', 'Elderberry', null),
|
|
20
|
+
(6, 'veggie', 'Fennel', 1.80);
|
|
21
|
+
|
|
22
|
+
-- Aggregates with GROUP BY
|
|
23
|
+
select category, count(*) as cnt, sum(price) as total, avg(price) as mean, min(price) as lo, max(price) as hi
|
|
24
|
+
from items group by category order by category;
|
|
25
|
+
→ [{"category":"fruit","cnt":3,"total":2.25,"mean":1.125,"lo":0.75,"hi":1.5},{"category":"veggie","cnt":3,"total":7.05,"mean":2.35,"lo":1.8,"hi":3.25}]
|
|
26
|
+
|
|
27
|
+
-- Scalar functions in SELECT
|
|
28
|
+
select id, lower(name) as lname, upper(name) as uname, length(name) as len
|
|
29
|
+
from items where id <= 3 order by id;
|
|
30
|
+
→ [{"id":1,"lname":"apple","uname":"APPLE","len":5},{"id":2,"lname":"banana","uname":"BANANA","len":6},{"id":3,"lname":"carrot","uname":"CARROT","len":6}]
|
|
31
|
+
|
|
32
|
+
-- Scalar functions in WHERE
|
|
33
|
+
select name from items where length(name) > 5 order by name;
|
|
34
|
+
→ [{"name":"Banana"},{"name":"Carrot"},{"name":"Daikon"},{"name":"Elderberry"},{"name":"Fennel"}]
|
|
35
|
+
|
|
36
|
+
select name from items where lower(name) = 'apple';
|
|
37
|
+
→ [{"name":"Apple"}]
|
|
38
|
+
|
|
39
|
+
-- Scalar functions in ORDER BY
|
|
40
|
+
select name from items where price is not null order by length(name), name;
|
|
41
|
+
→ [{"name":"Apple"},{"name":"Banana"},{"name":"Carrot"},{"name":"Daikon"},{"name":"Fennel"}]
|
|
42
|
+
|
|
43
|
+
-- abs and round on table data
|
|
44
|
+
select id, round(abs(price - 2.0), 2) as delta, round(price, 1) as rounded
|
|
45
|
+
from items where price is not null order by id;
|
|
46
|
+
→ [{"id":1,"delta":0.5,"rounded":1.5},{"id":2,"delta":1.25,"rounded":0.8},{"id":3,"delta":0,"rounded":2},{"id":4,"delta":1.25,"rounded":3.3},{"id":6,"delta":0.2,"rounded":1.8}]
|
|
47
|
+
|
|
48
|
+
-- Nested function calls
|
|
49
|
+
select upper(substr(name, 1, 3)) as prefix from items order by id;
|
|
50
|
+
→ [{"prefix":"APP"},{"prefix":"BAN"},{"prefix":"CAR"},{"prefix":"DAI"},{"prefix":"ELD"},{"prefix":"FEN"}]
|
|
51
|
+
|
|
52
|
+
select lower(substr(name, length(name) - 2, 3)) as suffix from items where id <= 3 order by id;
|
|
53
|
+
→ [{"suffix":"ple"},{"suffix":"ana"},{"suffix":"rot"}]
|
|
54
|
+
|
|
55
|
+
-- Mix scalar inside aggregate
|
|
56
|
+
select category, max(length(name)) as longest from items group by category order by category;
|
|
57
|
+
→ [{"category":"fruit","longest":10},{"category":"veggie","longest":6}]
|
|
58
|
+
|
|
59
|
+
drop table items;
|
|
60
|
+
|
|
61
|
+
-- ============================================================
|
|
62
|
+
-- Section 2: Function argument validation
|
|
63
|
+
-- ============================================================
|
|
64
|
+
|
|
65
|
+
-- Wrong number of args: abs() with no args
|
|
66
|
+
select abs();
|
|
67
|
+
-- error: Function not found
|
|
68
|
+
|
|
69
|
+
-- Wrong number of args: abs() with too many args
|
|
70
|
+
select abs(1, 2);
|
|
71
|
+
-- error: Function not found
|
|
72
|
+
|
|
73
|
+
-- Wrong number of args: length() with no args
|
|
74
|
+
select length();
|
|
75
|
+
-- error: Function not found
|
|
76
|
+
|
|
77
|
+
-- Wrong number of args: round() with too many args
|
|
78
|
+
select round(1.5, 2, 3);
|
|
79
|
+
-- error: Function not found
|
|
80
|
+
|
|
81
|
+
-- Non-existent function
|
|
82
|
+
select non_existent_function(1);
|
|
83
|
+
-- error: Function not found
|
|
84
|
+
|
|
85
|
+
-- Non-existent function with multiple args
|
|
86
|
+
select totally_made_up(1, 2, 3);
|
|
87
|
+
-- error: Function not found
|
|
88
|
+
|
|
89
|
+
-- coalesce() is variadic: 1 arg
|
|
90
|
+
select coalesce(42) as result;
|
|
91
|
+
→ [{"result":42}]
|
|
92
|
+
|
|
93
|
+
-- coalesce() variadic: 2 args
|
|
94
|
+
select coalesce(null, 'fallback') as result;
|
|
95
|
+
→ [{"result":"fallback"}]
|
|
96
|
+
|
|
97
|
+
-- coalesce() variadic: 3 args
|
|
98
|
+
select coalesce(null, null, 'last') as result;
|
|
99
|
+
→ [{"result":"last"}]
|
|
100
|
+
|
|
101
|
+
-- coalesce() variadic: 5 args
|
|
102
|
+
select coalesce(null, null, null, null, 99) as result;
|
|
103
|
+
→ [{"result":99}]
|
|
104
|
+
|
|
105
|
+
-- coalesce() returns first non-null
|
|
106
|
+
select coalesce('first', 'second', 'third') as result;
|
|
107
|
+
→ [{"result":"first"}]
|
|
108
|
+
|
|
109
|
+
-- greatest/least are variadic
|
|
110
|
+
select greatest(3, 1, 4, 1, 5, 9, 2, 6) as g, least(3, 1, 4, 1, 5, 9, 2, 6) as l;
|
|
111
|
+
→ [{"g":9,"l":1}]
|
|
112
|
+
|
|
113
|
+
-- ============================================================
|
|
114
|
+
-- Section 3: Window functions
|
|
115
|
+
-- ============================================================
|
|
116
|
+
|
|
117
|
+
create table scores (
|
|
118
|
+
id integer primary key,
|
|
119
|
+
student text,
|
|
120
|
+
subject text,
|
|
121
|
+
score integer
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
insert into scores values
|
|
125
|
+
(1, 'Alice', 'Math', 90),
|
|
126
|
+
(2, 'Alice', 'Science', 85),
|
|
127
|
+
(3, 'Bob', 'Math', 90),
|
|
128
|
+
(4, 'Bob', 'Science', 95),
|
|
129
|
+
(5, 'Carol', 'Math', 80),
|
|
130
|
+
(6, 'Carol', 'Science', 88);
|
|
131
|
+
|
|
132
|
+
-- Running sum with ORDER BY
|
|
133
|
+
select student, subject, score,
|
|
134
|
+
sum(score) over (order by id rows unbounded preceding) as running_total
|
|
135
|
+
from scores order by id;
|
|
136
|
+
→ [{"student":"Alice","subject":"Math","score":90,"running_total":90},{"student":"Alice","subject":"Science","score":85,"running_total":175},{"student":"Bob","subject":"Math","score":90,"running_total":265},{"student":"Bob","subject":"Science","score":95,"running_total":360},{"student":"Carol","subject":"Math","score":80,"running_total":440},{"student":"Carol","subject":"Science","score":88,"running_total":528}]
|
|
137
|
+
|
|
138
|
+
-- count() OVER (PARTITION BY ...)
|
|
139
|
+
select student, subject,
|
|
140
|
+
count(*) over (partition by student) as exams_taken
|
|
141
|
+
from scores order by student, subject;
|
|
142
|
+
→ [{"student":"Alice","subject":"Math","exams_taken":2},{"student":"Alice","subject":"Science","exams_taken":2},{"student":"Bob","subject":"Math","exams_taken":2},{"student":"Bob","subject":"Science","exams_taken":2},{"student":"Carol","subject":"Math","exams_taken":2},{"student":"Carol","subject":"Science","exams_taken":2}]
|
|
143
|
+
|
|
144
|
+
-- row_number() OVER (ORDER BY ...)
|
|
145
|
+
select student, score,
|
|
146
|
+
row_number() over (order by score desc, student) as rank_pos
|
|
147
|
+
from scores order by score desc, student;
|
|
148
|
+
→ [{"student":"Bob","score":95,"rank_pos":1},{"student":"Alice","score":90,"rank_pos":2},{"student":"Bob","score":90,"rank_pos":3},{"student":"Carol","score":88,"rank_pos":4},{"student":"Alice","score":85,"rank_pos":5},{"student":"Carol","score":80,"rank_pos":6}]
|
|
149
|
+
|
|
150
|
+
-- rank() with ties
|
|
151
|
+
select subject, score,
|
|
152
|
+
rank() over (order by score desc) as rnk
|
|
153
|
+
from scores order by score desc, subject;
|
|
154
|
+
→ [{"subject":"Science","score":95,"rnk":1},{"subject":"Math","score":90,"rnk":2},{"subject":"Math","score":90,"rnk":2},{"subject":"Science","score":88,"rnk":4},{"subject":"Science","score":85,"rnk":5},{"subject":"Math","score":80,"rnk":6}]
|
|
155
|
+
|
|
156
|
+
-- dense_rank() with ties (no gaps)
|
|
157
|
+
select subject, score,
|
|
158
|
+
dense_rank() over (order by score desc) as drnk
|
|
159
|
+
from scores order by score desc, subject;
|
|
160
|
+
→ [{"subject":"Science","score":95,"drnk":1},{"subject":"Math","score":90,"drnk":2},{"subject":"Math","score":90,"drnk":2},{"subject":"Science","score":88,"drnk":3},{"subject":"Science","score":85,"drnk":4},{"subject":"Math","score":80,"drnk":5}]
|
|
161
|
+
|
|
162
|
+
-- Partitioned running sum
|
|
163
|
+
select student, score,
|
|
164
|
+
sum(score) over (partition by student order by id rows unbounded preceding) as student_running
|
|
165
|
+
from scores order by student, id;
|
|
166
|
+
→ [{"student":"Alice","score":90,"student_running":90},{"student":"Alice","score":85,"student_running":175},{"student":"Bob","score":90,"student_running":90},{"student":"Bob","score":95,"student_running":185},{"student":"Carol","score":80,"student_running":80},{"student":"Carol","score":88,"student_running":168}]
|
|
167
|
+
|
|
168
|
+
-- Multiple window functions in one query
|
|
169
|
+
select student, score,
|
|
170
|
+
row_number() over (partition by student order by score desc) as rn,
|
|
171
|
+
sum(score) over (partition by student) as total
|
|
172
|
+
from scores order by student, score desc;
|
|
173
|
+
→ [{"student":"Alice","score":90,"rn":1,"total":175},{"student":"Alice","score":85,"rn":2,"total":175},{"student":"Bob","score":95,"rn":1,"total":185},{"student":"Bob","score":90,"rn":2,"total":185},{"student":"Carol","score":88,"rn":1,"total":168},{"student":"Carol","score":80,"rn":2,"total":168}]
|
|
174
|
+
|
|
175
|
+
drop table scores;
|
|
176
|
+
|
|
177
|
+
-- ============================================================
|
|
178
|
+
-- Section 4: Type coercion in functions
|
|
179
|
+
-- ============================================================
|
|
180
|
+
|
|
181
|
+
-- abs() on numeric column types
|
|
182
|
+
create table nums (id integer primary key, ival integer null, rval real null);
|
|
183
|
+
insert into nums values (1, -42, -3.14), (2, 7, 2.5), (3, null, null);
|
|
184
|
+
|
|
185
|
+
select id, abs(ival) as ai, abs(rval) as ar from nums order by id;
|
|
186
|
+
→ [{"id":1,"ai":42,"ar":3.14},{"id":2,"ai":7,"ar":2.5},{"id":3,"ai":null,"ar":null}]
|
|
187
|
+
|
|
188
|
+
-- length() on text column
|
|
189
|
+
create table strs (id integer primary key, val text null);
|
|
190
|
+
insert into strs values (1, 'hello'), (2, ''), (3, null);
|
|
191
|
+
|
|
192
|
+
select id, length(val) as len from strs order by id;
|
|
193
|
+
→ [{"id":1,"len":5},{"id":2,"len":0},{"id":3,"len":null}]
|
|
194
|
+
|
|
195
|
+
-- length() on text literals
|
|
196
|
+
select length('hello') as a, length('') as b, length('quereus') as c;
|
|
197
|
+
→ [{"a":5,"b":0,"c":7}]
|
|
198
|
+
|
|
199
|
+
-- length() on non-text returns null (type-strict)
|
|
200
|
+
select length(12345) as int_len, length(3.14) as real_len;
|
|
201
|
+
→ [{"int_len":null,"real_len":null}]
|
|
202
|
+
|
|
203
|
+
-- round() with different precision values
|
|
204
|
+
select round(3.14159, 0) as r0, round(3.14159, 1) as r1, round(3.14159, 2) as r2, round(3.14159, 4) as r4;
|
|
205
|
+
→ [{"r0":3,"r1":3.1,"r2":3.14,"r4":3.1416}]
|
|
206
|
+
|
|
207
|
+
-- round() with no precision
|
|
208
|
+
select round(2.7) as r;
|
|
209
|
+
→ [{"r":3}]
|
|
210
|
+
|
|
211
|
+
-- round() with negative precision (rounds to tens)
|
|
212
|
+
select round(12345, -1) as r1, round(12345, -2) as r2;
|
|
213
|
+
→ [{"r1":12350,"r2":12300}]
|
|
214
|
+
|
|
215
|
+
-- round on column data
|
|
216
|
+
select id, round(rval, 1) as rounded from nums where rval is not null order by id;
|
|
217
|
+
→ [{"id":1,"rounded":-3.1},{"id":2,"rounded":2.5}]
|
|
218
|
+
|
|
219
|
+
-- typeof() showing result types
|
|
220
|
+
select typeof(42) as t_int, typeof(3.14) as t_real, typeof('text') as t_text, typeof(null) as t_null;
|
|
221
|
+
→ [{"t_int":"integer","t_real":"real","t_text":"text","t_null":"null"}]
|
|
222
|
+
|
|
223
|
+
-- typeof on expressions
|
|
224
|
+
select typeof(1 + 2) as t_add, typeof(1.0 + 2) as t_mixed, typeof('a' || 'b') as t_concat;
|
|
225
|
+
→ [{"t_add":"integer","t_mixed":"integer","t_concat":"text"}]
|
|
226
|
+
|
|
227
|
+
-- typeof on function results
|
|
228
|
+
select typeof(abs(-5)) as t_abs, typeof(length('hi')) as t_len, typeof(lower('HI')) as t_lower;
|
|
229
|
+
→ [{"t_abs":"integer","t_len":"integer","t_lower":"text"}]
|
|
230
|
+
|
|
231
|
+
-- typeof on column data
|
|
232
|
+
select id, typeof(ival) as ti, typeof(rval) as tr from nums order by id;
|
|
233
|
+
→ [{"id":1,"ti":"integer","tr":"real"},{"id":2,"ti":"integer","tr":"real"},{"id":3,"ti":"null","tr":"null"}]
|
|
234
|
+
|
|
235
|
+
-- coalesce type behavior
|
|
236
|
+
select typeof(coalesce(null, 42)) as t1, typeof(coalesce(null, 'text')) as t2;
|
|
237
|
+
→ [{"t1":"integer","t2":"text"}]
|
|
238
|
+
|
|
239
|
+
-- abs() rejects text type at plan time
|
|
240
|
+
create table text_vals (id integer primary key, val text);
|
|
241
|
+
insert into text_vals values (1, '42');
|
|
242
|
+
select abs(val) from text_vals;
|
|
243
|
+
-- error: Invalid argument types
|
|
244
|
+
|
|
245
|
+
drop table nums;
|
|
246
|
+
drop table strs;
|
|
247
|
+
drop table text_vals;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
-- schema-scale.sqllogic - Performance test for large schema operations
|
|
2
|
+
-- Tests schema manager with 20 tables and cross-table queries
|
|
3
|
+
-- (the many-indexes half is 10.4.1-schema-scale-indexes)
|
|
4
|
+
|
|
5
|
+
-- ===================================
|
|
6
|
+
-- 1. Create 20 tables with varied schemas
|
|
7
|
+
-- ===================================
|
|
8
|
+
|
|
9
|
+
create table t01 (id integer primary key, name text, value integer);
|
|
10
|
+
create table t02 (id integer primary key, code text, amount real);
|
|
11
|
+
create table t03 (id integer primary key, label text, count integer, active integer);
|
|
12
|
+
create table t04 (id integer primary key, title text, score real);
|
|
13
|
+
create table t05 (id integer primary key, details text, quantity integer);
|
|
14
|
+
create table t06 (id integer primary key, tag text, price real);
|
|
15
|
+
create table t07 (id integer primary key, category text, stock integer);
|
|
16
|
+
create table t08 (id integer primary key, type text, level integer);
|
|
17
|
+
create table t09 (id integer primary key, status text, priority integer);
|
|
18
|
+
create table t10 (id integer primary key, role text, rank integer);
|
|
19
|
+
create table t11 (id integer primary key, name text, value integer);
|
|
20
|
+
create table t12 (id integer primary key, code text, amount real);
|
|
21
|
+
create table t13 (id integer primary key, label text, count integer, active integer);
|
|
22
|
+
create table t14 (id integer primary key, title text, score real);
|
|
23
|
+
create table t15 (id integer primary key, details text, quantity integer);
|
|
24
|
+
create table t16 (id integer primary key, tag text, price real);
|
|
25
|
+
create table t17 (id integer primary key, category text, stock integer);
|
|
26
|
+
create table t18 (id integer primary key, type text, level integer);
|
|
27
|
+
create table t19 (id integer primary key, status text, priority integer);
|
|
28
|
+
create table t20 (id integer primary key, role text, rank integer);
|
|
29
|
+
|
|
30
|
+
-- ===================================
|
|
31
|
+
-- 2. Insert data into all tables
|
|
32
|
+
-- ===================================
|
|
33
|
+
|
|
34
|
+
insert into t01 values (1, 'a1', 10), (2, 'a2', 20), (3, 'a3', 30);
|
|
35
|
+
insert into t02 values (1, 'b1', 1.5), (2, 'b2', 2.5), (3, 'b3', 3.5);
|
|
36
|
+
insert into t03 values (1, 'c1', 100, 1), (2, 'c2', 200, 0), (3, 'c3', 300, 1);
|
|
37
|
+
insert into t04 values (1, 'd1', 50.0), (2, 'd2', 60.0), (3, 'd3', 70.0);
|
|
38
|
+
insert into t05 values (1, 'e1', 5), (2, 'e2', 6), (3, 'e3', 7);
|
|
39
|
+
insert into t06 values (1, 'f1', 10.1), (2, 'f2', 20.2), (3, 'f3', 30.3);
|
|
40
|
+
insert into t07 values (1, 'g1', 15), (2, 'g2', 25), (3, 'g3', 35);
|
|
41
|
+
insert into t08 values (1, 'h1', 8), (2, 'h2', 9), (3, 'h3', 10);
|
|
42
|
+
insert into t09 values (1, 'i1', 1), (2, 'i2', 2), (3, 'i3', 3);
|
|
43
|
+
insert into t10 values (1, 'j1', 11), (2, 'j2', 12), (3, 'j3', 13);
|
|
44
|
+
insert into t11 values (1, 'k1', 40), (2, 'k2', 50), (3, 'k3', 60);
|
|
45
|
+
insert into t12 values (1, 'l1', 4.1), (2, 'l2', 5.2), (3, 'l3', 6.3);
|
|
46
|
+
insert into t13 values (1, 'm1', 400, 1), (2, 'm2', 500, 0), (3, 'm3', 600, 1);
|
|
47
|
+
insert into t14 values (1, 'n1', 80.0), (2, 'n2', 90.0), (3, 'n3', 100.0);
|
|
48
|
+
insert into t15 values (1, 'o1', 9), (2, 'o2', 10), (3, 'o3', 11);
|
|
49
|
+
insert into t16 values (1, 'p1', 11.1), (2, 'p2', 22.2), (3, 'p3', 33.3);
|
|
50
|
+
insert into t17 values (1, 'q1', 45), (2, 'q2', 55), (3, 'q3', 65);
|
|
51
|
+
insert into t18 values (1, 'r1', 18), (2, 'r2', 19), (3, 'r3', 20);
|
|
52
|
+
insert into t19 values (1, 's1', 4), (2, 's2', 5), (3, 's3', 6);
|
|
53
|
+
insert into t20 values (1, 't1', 21), (2, 't2', 22), (3, 't3', 23);
|
|
54
|
+
|
|
55
|
+
-- Section 3 (22 secondary indexes over these 20 tables, the point lookups through
|
|
56
|
+
-- them, and the schema() index count) lives in 10.4.1-schema-scale-indexes — it
|
|
57
|
+
-- needs standalone index DDL and rebuilds this rig for itself.
|
|
58
|
+
|
|
59
|
+
-- ===================================
|
|
60
|
+
-- 4. Query across multiple tables using joins
|
|
61
|
+
-- ===================================
|
|
62
|
+
|
|
63
|
+
-- Join t01 to t02
|
|
64
|
+
select t01.name, t02.code, t01.value, t02.amount
|
|
65
|
+
from t01 join t02 on t01.id = t02.id
|
|
66
|
+
order by t01.id;
|
|
67
|
+
→ [{"name":"a1","code":"b1","value":10,"amount":1.5},{"name":"a2","code":"b2","value":20,"amount":2.5},{"name":"a3","code":"b3","value":30,"amount":3.5}]
|
|
68
|
+
|
|
69
|
+
-- Join t03 to t04
|
|
70
|
+
select t03.label, t04.title, t03.count, t04.score
|
|
71
|
+
from t03 join t04 on t03.id = t04.id
|
|
72
|
+
order by t03.id;
|
|
73
|
+
→ [{"label":"c1","title":"d1","count":100,"score":50.0},{"label":"c2","title":"d2","count":200,"score":60.0},{"label":"c3","title":"d3","count":300,"score":70.0}]
|
|
74
|
+
|
|
75
|
+
-- Join t05 to t06
|
|
76
|
+
select t05.details, t06.tag, t05.quantity, t06.price
|
|
77
|
+
from t05 join t06 on t05.id = t06.id
|
|
78
|
+
order by t05.id;
|
|
79
|
+
→ [{"details":"e1","tag":"f1","quantity":5,"price":10.1},{"details":"e2","tag":"f2","quantity":6,"price":20.2},{"details":"e3","tag":"f3","quantity":7,"price":30.3}]
|
|
80
|
+
|
|
81
|
+
-- Join t07 to t08
|
|
82
|
+
select t07.category, t08.type, t07.stock, t08.level
|
|
83
|
+
from t07 join t08 on t07.id = t08.id
|
|
84
|
+
order by t07.id;
|
|
85
|
+
→ [{"category":"g1","type":"h1","stock":15,"level":8},{"category":"g2","type":"h2","stock":25,"level":9},{"category":"g3","type":"h3","stock":35,"level":10}]
|
|
86
|
+
|
|
87
|
+
-- Join t09 to t10
|
|
88
|
+
select t09.status, t10.role, t09.priority, t10.rank
|
|
89
|
+
from t09 join t10 on t09.id = t10.id
|
|
90
|
+
order by t09.id;
|
|
91
|
+
→ [{"status":"i1","role":"j1","priority":1,"rank":11},{"status":"i2","role":"j2","priority":2,"rank":12},{"status":"i3","role":"j3","priority":3,"rank":13}]
|
|
92
|
+
|
|
93
|
+
-- Three-way join: t11, t12, t13
|
|
94
|
+
select t11.name, t12.code, t13.label, t11.value, t12.amount, t13.count
|
|
95
|
+
from t11 join t12 on t11.id = t12.id join t13 on t12.id = t13.id
|
|
96
|
+
order by t11.id;
|
|
97
|
+
→ [{"name":"k1","code":"l1","label":"m1","value":40,"amount":4.1,"count":400},{"name":"k2","code":"l2","label":"m2","value":50,"amount":5.2,"count":500},{"name":"k3","code":"l3","label":"m3","value":60,"amount":6.3,"count":600}]
|
|
98
|
+
|
|
99
|
+
-- Join t14 to t15
|
|
100
|
+
select t14.title, t15.details, t14.score, t15.quantity
|
|
101
|
+
from t14 join t15 on t14.id = t15.id
|
|
102
|
+
order by t14.id;
|
|
103
|
+
→ [{"title":"n1","details":"o1","score":80.0,"quantity":9},{"title":"n2","details":"o2","score":90.0,"quantity":10},{"title":"n3","details":"o3","score":100.0,"quantity":11}]
|
|
104
|
+
|
|
105
|
+
-- Join t16 to t17
|
|
106
|
+
select t16.tag, t17.category, t16.price, t17.stock
|
|
107
|
+
from t16 join t17 on t16.id = t17.id
|
|
108
|
+
order by t16.id;
|
|
109
|
+
→ [{"tag":"p1","category":"q1","price":11.1,"stock":45},{"tag":"p2","category":"q2","price":22.2,"stock":55},{"tag":"p3","category":"q3","price":33.3,"stock":65}]
|
|
110
|
+
|
|
111
|
+
-- Join t18 to t19
|
|
112
|
+
select t18.type, t19.status, t18.level, t19.priority
|
|
113
|
+
from t18 join t19 on t18.id = t19.id
|
|
114
|
+
order by t18.id;
|
|
115
|
+
→ [{"type":"r1","status":"s1","level":18,"priority":4},{"type":"r2","status":"s2","level":19,"priority":5},{"type":"r3","status":"s3","level":20,"priority":6}]
|
|
116
|
+
|
|
117
|
+
-- Cross join across multiple tables
|
|
118
|
+
select count(*) as total
|
|
119
|
+
from t01 cross join t02 cross join t03;
|
|
120
|
+
→ [{"total":27}]
|
|
121
|
+
|
|
122
|
+
-- ===================================
|
|
123
|
+
-- 6. Verify all tables exist in schema
|
|
124
|
+
-- ===================================
|
|
125
|
+
|
|
126
|
+
select count(*) as table_count from schema() where type = 'table' and name like 't%';
|
|
127
|
+
→ [{"table_count":20}]
|
|
128
|
+
|
|
129
|
+
-- ===================================
|
|
130
|
+
-- 7. Drop all tables
|
|
131
|
+
-- ===================================
|
|
132
|
+
|
|
133
|
+
drop table t01;
|
|
134
|
+
drop table t02;
|
|
135
|
+
drop table t03;
|
|
136
|
+
drop table t04;
|
|
137
|
+
drop table t05;
|
|
138
|
+
drop table t06;
|
|
139
|
+
drop table t07;
|
|
140
|
+
drop table t08;
|
|
141
|
+
drop table t09;
|
|
142
|
+
drop table t10;
|
|
143
|
+
drop table t11;
|
|
144
|
+
drop table t12;
|
|
145
|
+
drop table t13;
|
|
146
|
+
drop table t14;
|
|
147
|
+
drop table t15;
|
|
148
|
+
drop table t16;
|
|
149
|
+
drop table t17;
|
|
150
|
+
drop table t18;
|
|
151
|
+
drop table t19;
|
|
152
|
+
drop table t20;
|
|
153
|
+
|
|
154
|
+
-- ===================================
|
|
155
|
+
-- 8. Verify all tables are gone
|
|
156
|
+
-- ===================================
|
|
157
|
+
|
|
158
|
+
select * from t01;
|
|
159
|
+
-- error: not found in schema path
|
|
160
|
+
|
|
161
|
+
select * from t10;
|
|
162
|
+
-- error: not found in schema path
|
|
163
|
+
|
|
164
|
+
select * from t20;
|
|
165
|
+
-- error: not found in schema path
|
|
166
|
+
|
|
167
|
+
select count(*) as table_count from schema() where type = 'table' and name like 't%';
|
|
168
|
+
→ [{"table_count":0}]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
-- 10.4.1-schema-scale-indexes.sqllogic - Performance test for large schema operations: many indexes
|
|
2
|
+
--
|
|
3
|
+
-- requires-capability: standalone-index-ddl
|
|
4
|
+
--
|
|
5
|
+
-- Carved out of 10.4-schema-scale: the table-scale half of that stress rig (20 tables,
|
|
6
|
+
-- cross-table joins, schema() table counts, bulk drop) needs no index DDL. This half
|
|
7
|
+
-- puts 22 secondary indexes over the same 20 tables, so it lives here.
|
|
8
|
+
--
|
|
9
|
+
-- The 20-table rig is rebuilt below rather than shared — the two files run as separate
|
|
10
|
+
-- databases, and only t01/t02/t03 need rows for the lookups asserted here.
|
|
11
|
+
--
|
|
12
|
+
-- Subject: the schema manager holds 22 indexes across 20 tables, schema() counts them,
|
|
13
|
+
-- and point lookups through indexed columns answer correctly.
|
|
14
|
+
|
|
15
|
+
-- ===================================
|
|
16
|
+
-- 1. Create 20 tables with varied schemas
|
|
17
|
+
-- ===================================
|
|
18
|
+
|
|
19
|
+
create table t01 (id integer primary key, name text, value integer);
|
|
20
|
+
create table t02 (id integer primary key, code text, amount real);
|
|
21
|
+
create table t03 (id integer primary key, label text, count integer, active integer);
|
|
22
|
+
create table t04 (id integer primary key, title text, score real);
|
|
23
|
+
create table t05 (id integer primary key, details text, quantity integer);
|
|
24
|
+
create table t06 (id integer primary key, tag text, price real);
|
|
25
|
+
create table t07 (id integer primary key, category text, stock integer);
|
|
26
|
+
create table t08 (id integer primary key, type text, level integer);
|
|
27
|
+
create table t09 (id integer primary key, status text, priority integer);
|
|
28
|
+
create table t10 (id integer primary key, role text, rank integer);
|
|
29
|
+
create table t11 (id integer primary key, name text, value integer);
|
|
30
|
+
create table t12 (id integer primary key, code text, amount real);
|
|
31
|
+
create table t13 (id integer primary key, label text, count integer, active integer);
|
|
32
|
+
create table t14 (id integer primary key, title text, score real);
|
|
33
|
+
create table t15 (id integer primary key, details text, quantity integer);
|
|
34
|
+
create table t16 (id integer primary key, tag text, price real);
|
|
35
|
+
create table t17 (id integer primary key, category text, stock integer);
|
|
36
|
+
create table t18 (id integer primary key, type text, level integer);
|
|
37
|
+
create table t19 (id integer primary key, status text, priority integer);
|
|
38
|
+
create table t20 (id integer primary key, role text, rank integer);
|
|
39
|
+
|
|
40
|
+
-- ===================================
|
|
41
|
+
-- 2. Insert data into the tables the lookups below read
|
|
42
|
+
-- ===================================
|
|
43
|
+
|
|
44
|
+
insert into t01 values (1, 'a1', 10), (2, 'a2', 20), (3, 'a3', 30);
|
|
45
|
+
insert into t02 values (1, 'b1', 1.5), (2, 'b2', 2.5), (3, 'b3', 3.5);
|
|
46
|
+
insert into t03 values (1, 'c1', 100, 1), (2, 'c2', 200, 0), (3, 'c3', 300, 1);
|
|
47
|
+
|
|
48
|
+
-- ===================================
|
|
49
|
+
-- 3. Create indexes on several tables
|
|
50
|
+
-- ===================================
|
|
51
|
+
|
|
52
|
+
create index idx_t01_name on t01 (name);
|
|
53
|
+
create index idx_t01_value on t01 (value);
|
|
54
|
+
create index idx_t02_code on t02 (code);
|
|
55
|
+
create index idx_t03_label on t03 (label);
|
|
56
|
+
create index idx_t03_active on t03 (active);
|
|
57
|
+
create index idx_t04_title on t04 (title);
|
|
58
|
+
create index idx_t05_details on t05 (details);
|
|
59
|
+
create index idx_t06_tag on t06 (tag);
|
|
60
|
+
create index idx_t07_category on t07 (category);
|
|
61
|
+
create index idx_t08_type on t08 (type);
|
|
62
|
+
create index idx_t09_status on t09 (status);
|
|
63
|
+
create index idx_t10_role on t10 (role);
|
|
64
|
+
create index idx_t11_name on t11 (name);
|
|
65
|
+
create index idx_t12_code on t12 (code);
|
|
66
|
+
create index idx_t13_label on t13 (label);
|
|
67
|
+
create index idx_t14_title on t14 (title);
|
|
68
|
+
create index idx_t15_details on t15 (details);
|
|
69
|
+
create index idx_t16_tag on t16 (tag);
|
|
70
|
+
create index idx_t17_category on t17 (category);
|
|
71
|
+
create index idx_t18_type on t18 (type);
|
|
72
|
+
create index idx_t19_status on t19 (status);
|
|
73
|
+
create index idx_t20_role on t20 (role);
|
|
74
|
+
|
|
75
|
+
-- ===================================
|
|
76
|
+
-- 4. Verify indexes are working
|
|
77
|
+
-- ===================================
|
|
78
|
+
|
|
79
|
+
select name from t01 where name = 'a2';
|
|
80
|
+
→ [{"name":"a2"}]
|
|
81
|
+
|
|
82
|
+
select code from t02 where code = 'b3';
|
|
83
|
+
→ [{"code":"b3"}]
|
|
84
|
+
|
|
85
|
+
select label from t03 where active = 1 order by id;
|
|
86
|
+
→ [{"label":"c1"},{"label":"c3"}]
|
|
87
|
+
|
|
88
|
+
-- ===================================
|
|
89
|
+
-- 5. Verify all indexes exist in schema
|
|
90
|
+
-- ===================================
|
|
91
|
+
|
|
92
|
+
select count(*) as index_count from schema() where type = 'index' and tbl_name like 't%';
|
|
93
|
+
→ [{"index_count":22}]
|
|
94
|
+
|
|
95
|
+
-- ===================================
|
|
96
|
+
-- 6. Drop all tables (indexes go with them)
|
|
97
|
+
-- ===================================
|
|
98
|
+
|
|
99
|
+
drop table t01;
|
|
100
|
+
drop table t02;
|
|
101
|
+
drop table t03;
|
|
102
|
+
drop table t04;
|
|
103
|
+
drop table t05;
|
|
104
|
+
drop table t06;
|
|
105
|
+
drop table t07;
|
|
106
|
+
drop table t08;
|
|
107
|
+
drop table t09;
|
|
108
|
+
drop table t10;
|
|
109
|
+
drop table t11;
|
|
110
|
+
drop table t12;
|
|
111
|
+
drop table t13;
|
|
112
|
+
drop table t14;
|
|
113
|
+
drop table t15;
|
|
114
|
+
drop table t16;
|
|
115
|
+
drop table t17;
|
|
116
|
+
drop table t18;
|
|
117
|
+
drop table t19;
|
|
118
|
+
drop table t20;
|
|
119
|
+
|
|
120
|
+
select count(*) as index_count from schema() where type = 'index' and tbl_name like 't%';
|
|
121
|
+
→ [{"index_count":0}]
|