@quereus/quereus 4.20.1 → 4.20.3
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/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +17 -69
- package/dist/src/schema/schema-differ.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 +210 -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,124 @@
|
|
|
1
|
+
-- 05.2-cast-seek-correctness.sqllogic
|
|
2
|
+
-- Regression: a comparison whose column operand is wrapped in a value-changing
|
|
3
|
+
-- CAST must not contribute an index-seek constraint. The constraint extractor
|
|
4
|
+
-- used to strip every CastNode, so `cast(x as integer) = 1` on a TEXT primary
|
|
5
|
+
-- key was pushed down as a seek for the integer 1 against stored text — which
|
|
6
|
+
-- matches nothing under storage-class ordering — and the conjunct was reported
|
|
7
|
+
-- as fully consumed, so no residual filter survived to catch the mistake.
|
|
8
|
+
--
|
|
9
|
+
-- The last group matters most: `insertCrossTypeCoercion` wraps the textual
|
|
10
|
+
-- operand of a numeric comparison in a synthetic cast, so a bare `x = 1` on a
|
|
11
|
+
-- TEXT column hits the same path with no explicit CAST in the SQL.
|
|
12
|
+
--
|
|
13
|
+
-- Every query is paired with the identical predicate over a non-indexed column
|
|
14
|
+
-- of the same declared type; indexed and non-indexed must agree. The TEXT group
|
|
15
|
+
-- is followed by REAL and BLOB keys, whose converting casts (truncation, UTF-8
|
|
16
|
+
-- decode) change the value without crossing into a text/number mismatch.
|
|
17
|
+
--
|
|
18
|
+
-- Plan shapes are pinned separately in `test/plan/cast-seek-blocking.spec.ts`.
|
|
19
|
+
|
|
20
|
+
PRAGMA default_vtab_module='memory';
|
|
21
|
+
|
|
22
|
+
-- x is the primary key → the optimizer will try to seek on it.
|
|
23
|
+
CREATE TABLE t (x TEXT PRIMARY KEY);
|
|
24
|
+
INSERT INTO t VALUES ('1'), ('1abc'), ('2');
|
|
25
|
+
|
|
26
|
+
-- Same rows, but x is an ordinary column (control: was always correct).
|
|
27
|
+
CREATE TABLE u (id INTEGER PRIMARY KEY, x TEXT);
|
|
28
|
+
INSERT INTO u VALUES (1, '1'), (2, '1abc'), (3, '2');
|
|
29
|
+
|
|
30
|
+
-- Equality through a converting cast, column on the left.
|
|
31
|
+
SELECT x FROM t WHERE CAST(x AS INTEGER) = 1 ORDER BY x;
|
|
32
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
33
|
+
|
|
34
|
+
SELECT x FROM u WHERE CAST(x AS INTEGER) = 1 ORDER BY x;
|
|
35
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
36
|
+
|
|
37
|
+
-- Same, operands flipped.
|
|
38
|
+
SELECT x FROM t WHERE 1 = CAST(x AS INTEGER) ORDER BY x;
|
|
39
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
40
|
+
|
|
41
|
+
SELECT x FROM u WHERE 1 = CAST(x AS INTEGER) ORDER BY x;
|
|
42
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
43
|
+
|
|
44
|
+
-- Degenerate range through a converting cast.
|
|
45
|
+
SELECT x FROM t WHERE CAST(x AS INTEGER) BETWEEN 1 AND 1 ORDER BY x;
|
|
46
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
47
|
+
|
|
48
|
+
SELECT x FROM u WHERE CAST(x AS INTEGER) BETWEEN 1 AND 1 ORDER BY x;
|
|
49
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
50
|
+
|
|
51
|
+
-- IN over a cast condition was already correct (extractInConstraint requires a
|
|
52
|
+
-- bare column reference); pinned so it stays that way.
|
|
53
|
+
SELECT x FROM t WHERE CAST(x AS INTEGER) IN (1) ORDER BY x;
|
|
54
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
55
|
+
|
|
56
|
+
SELECT x FROM u WHERE CAST(x AS INTEGER) IN (1) ORDER BY x;
|
|
57
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
58
|
+
|
|
59
|
+
-- Two-branch OR: the collapse to an IN constraint must not see through the cast.
|
|
60
|
+
SELECT x FROM t WHERE CAST(x AS INTEGER) = 1 OR CAST(x AS INTEGER) = 2 ORDER BY x;
|
|
61
|
+
→ [{"x":"1"},{"x":"1abc"},{"x":"2"}]
|
|
62
|
+
|
|
63
|
+
SELECT x FROM u WHERE CAST(x AS INTEGER) = 1 OR CAST(x AS INTEGER) = 2 ORDER BY x;
|
|
64
|
+
→ [{"x":"1"},{"x":"1abc"},{"x":"2"}]
|
|
65
|
+
|
|
66
|
+
-- Implicit coercion: no CAST written, but the planner inserts one over `x`.
|
|
67
|
+
SELECT x FROM t WHERE x = 1 ORDER BY x;
|
|
68
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
69
|
+
|
|
70
|
+
SELECT x FROM u WHERE x = 1 ORDER BY x;
|
|
71
|
+
→ [{"x":"1"},{"x":"1abc"}]
|
|
72
|
+
|
|
73
|
+
-- Control: a text-vs-text equality needs no coercion and still seeks.
|
|
74
|
+
SELECT x FROM t WHERE x = '1' ORDER BY x;
|
|
75
|
+
→ [{"x":"1"}]
|
|
76
|
+
|
|
77
|
+
SELECT x FROM u WHERE x = '1' ORDER BY x;
|
|
78
|
+
→ [{"x":"1"}]
|
|
79
|
+
|
|
80
|
+
-- A no-op cast is value-preserving and must still fold away (seek preserved).
|
|
81
|
+
SELECT x FROM t WHERE CAST(x AS TEXT) = '1' ORDER BY x;
|
|
82
|
+
→ [{"x":"1"}]
|
|
83
|
+
|
|
84
|
+
DROP TABLE t;
|
|
85
|
+
DROP TABLE u;
|
|
86
|
+
|
|
87
|
+
-- Same shape over a REAL primary key: `cast(v as integer)` truncates, so the
|
|
88
|
+
-- seek key differs from the stored value even though both sides are numeric.
|
|
89
|
+
CREATE TABLE r (v REAL PRIMARY KEY);
|
|
90
|
+
INSERT INTO r VALUES (1.0), (1.5), (2.0);
|
|
91
|
+
|
|
92
|
+
CREATE TABLE s (id INTEGER PRIMARY KEY, v REAL);
|
|
93
|
+
INSERT INTO s VALUES (1, 1.0), (2, 1.5), (3, 2.0);
|
|
94
|
+
|
|
95
|
+
SELECT v FROM r WHERE CAST(v AS INTEGER) = 1 ORDER BY v;
|
|
96
|
+
→ [{"v":1},{"v":1.5}]
|
|
97
|
+
|
|
98
|
+
SELECT v FROM s WHERE CAST(v AS INTEGER) = 1 ORDER BY v;
|
|
99
|
+
→ [{"v":1},{"v":1.5}]
|
|
100
|
+
|
|
101
|
+
-- A no-op cast on the REAL key still folds away.
|
|
102
|
+
SELECT v FROM r WHERE CAST(v AS REAL) = 1.5 ORDER BY v;
|
|
103
|
+
→ [{"v":1.5}]
|
|
104
|
+
|
|
105
|
+
DROP TABLE r;
|
|
106
|
+
DROP TABLE s;
|
|
107
|
+
|
|
108
|
+
-- BLOB key: `cast(b as text)` decodes the bytes as UTF-8, so the cast's value is a
|
|
109
|
+
-- string and never the stored blob — it must not become a seek key.
|
|
110
|
+
-- `tag` names the row so the assertion needs no blob-formatting function.
|
|
111
|
+
CREATE TABLE bt (b BLOB PRIMARY KEY, tag TEXT);
|
|
112
|
+
INSERT INTO bt VALUES (x'31', 'one'), (x'32', 'two');
|
|
113
|
+
|
|
114
|
+
CREATE TABLE bu (id INTEGER PRIMARY KEY, b BLOB, tag TEXT);
|
|
115
|
+
INSERT INTO bu VALUES (1, x'31', 'one'), (2, x'32', 'two');
|
|
116
|
+
|
|
117
|
+
SELECT tag FROM bt WHERE CAST(b AS TEXT) = '1' ORDER BY tag;
|
|
118
|
+
→ [{"tag":"one"}]
|
|
119
|
+
|
|
120
|
+
SELECT tag FROM bu WHERE CAST(b AS TEXT) = '1' ORDER BY tag;
|
|
121
|
+
→ [{"tag":"one"}]
|
|
122
|
+
|
|
123
|
+
DROP TABLE bt;
|
|
124
|
+
DROP TABLE bu;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
-- builtin_functions.sqllogic - Testing various built-in functions
|
|
2
|
+
|
|
3
|
+
-- Scalar Functions
|
|
4
|
+
SELECT lower('Quereus'), upper('Quereus'), length('Quereus');
|
|
5
|
+
→ [{"lower('Quereus')":"quereus","upper('Quereus')":"QUEREUS","length('Quereus')":7}]
|
|
6
|
+
SELECT substr('Quereus', 2, 3), substring('Quereus', 4);
|
|
7
|
+
→ [{"substr('Quereus', 2, 3)":"uer","substring('Quereus', 4)":"reus"}]
|
|
8
|
+
SELECT abs(-10), round(12.345, 1), round(12.345);
|
|
9
|
+
→ [{"abs(-10)":10,"round(12.345, 1)":12.3,"round(12.345)":12}]
|
|
10
|
+
SELECT typeof(1), typeof(1.5), typeof('text'), typeof(x'01'), typeof(null), typeof(12345678901234567890);
|
|
11
|
+
→ [{"typeof(1)":"integer","typeof(1.5)":"real","typeof('text')":"text","typeof(x'01')":"blob","typeof(null)":"null","typeof(12345678901234567890)":"integer"}]
|
|
12
|
+
SELECT like('abc%', 'abcde'), glob('a*c', 'abbbc');
|
|
13
|
+
→ [{"like('abc%', 'abcde')":true,"glob('a*c', 'abbbc')":true}]
|
|
14
|
+
|
|
15
|
+
-- LIKE Operator Tests
|
|
16
|
+
CREATE TABLE like_test (id INT, name TEXT);
|
|
17
|
+
INSERT INTO like_test VALUES (1, 'apple'), (2, 'berry'), (3, 'citrus'), (4, 'orange');
|
|
18
|
+
|
|
19
|
+
-- Test basic LIKE operator
|
|
20
|
+
SELECT * FROM like_test WHERE name LIKE 'a%' ORDER BY id;
|
|
21
|
+
→ [{"id":1,"name":"apple"}]
|
|
22
|
+
|
|
23
|
+
-- Test NOT LIKE operator
|
|
24
|
+
SELECT * FROM like_test WHERE name NOT LIKE '%a%' ORDER BY id;
|
|
25
|
+
→ [{"id":2,"name":"berry"},{"id":3,"name":"citrus"}]
|
|
26
|
+
|
|
27
|
+
-- Test underscore wildcard
|
|
28
|
+
SELECT * FROM like_test WHERE name LIKE '_ra%' ORDER BY id;
|
|
29
|
+
→ [{"id":4,"name":"orange"}]
|
|
30
|
+
|
|
31
|
+
-- Test literal matching
|
|
32
|
+
SELECT * FROM like_test WHERE name LIKE 'apple';
|
|
33
|
+
→ [{"id":1,"name":"apple"}]
|
|
34
|
+
|
|
35
|
+
-- Test LIKE with NULL
|
|
36
|
+
SELECT * FROM like_test WHERE NULL LIKE 'a%';
|
|
37
|
+
→ []
|
|
38
|
+
|
|
39
|
+
-- Test pattern with NULL
|
|
40
|
+
SELECT * FROM like_test WHERE 'apple' LIKE NULL;
|
|
41
|
+
→ []
|
|
42
|
+
|
|
43
|
+
DROP TABLE like_test;
|
|
44
|
+
|
|
45
|
+
-- Date/Time Functions (output format depends on default build)
|
|
46
|
+
SELECT date('now') IS NOT NULL;
|
|
47
|
+
→ [true]
|
|
48
|
+
SELECT time('now') IS NOT NULL;
|
|
49
|
+
→ [true]
|
|
50
|
+
SELECT datetime('now') IS NOT NULL;
|
|
51
|
+
→ [true]
|
|
52
|
+
SELECT julianday('2024-01-01') - julianday('2023-01-01');
|
|
53
|
+
→ [365]
|
|
54
|
+
SELECT strftime('%Y-%m-%d', '2024-07-26');
|
|
55
|
+
→ ["2024-07-26"]
|
|
56
|
+
|
|
57
|
+
-- ISO Validation Functions
|
|
58
|
+
SELECT IsISODate('2024-02-29'), IsISODate('2023-02-29'), IsISODate('2024-13-01'), IsISODate('2024-01-32'), IsISODate('2024-01-01'), IsISODate(NULL);
|
|
59
|
+
→ [{"isisodate('2024-02-29')":true,"isisodate('2023-02-29')":false,"isisodate('2024-13-01')":false,"isisodate('2024-01-32')":false,"isisodate('2024-01-01')":true,"isisodate(null)":false}]
|
|
60
|
+
SELECT IsISODateTime('2024-01-01T00:00'), IsISODateTime('2024-01-01T00:00:00Z'), IsISODateTime('2024-01-01T23:59:59+05:30'), IsISODateTime('2024-01-01 00:00:00'), IsISODateTime('2024-01-01T24:00');
|
|
61
|
+
→ [{"isisodatetime('2024-01-01T00:00')":true,"isisodatetime('2024-01-01T00:00:00Z')":true,"isisodatetime('2024-01-01T23:59:59+05:30')":true,"isisodatetime('2024-01-01 00:00:00')":false,"isisodatetime('2024-01-01T24:00')":false}]
|
|
62
|
+
SELECT IsISODateTime('2024-01-01T10:00:00.123456789'), IsISODateTime('2024-01-01T10:00:00.1234567890');
|
|
63
|
+
→ [{"isisodatetime('2024-01-01T10:00:00.123456789')":true,"isisodatetime('2024-01-01T10:00:00.1234567890')":false}]
|
|
64
|
+
|
|
65
|
+
-- JSON Functions
|
|
66
|
+
SELECT json_valid('{"a": 1}'), json_valid('{');
|
|
67
|
+
→ [{"json_valid('{\"a\": 1}')":true,"json_valid('{')":false}]
|
|
68
|
+
SELECT json_type('{"a": 1}', '$.a'), json_type('[1, "t", null]', '[1]');
|
|
69
|
+
→ [{"json_type('{\"a\": 1}', '$.a')":"integer","json_type('[1, \"t\", null]', '[1]')":"text"}]
|
|
70
|
+
SELECT json_extract('{"a": [10, 20], "b": "foo"}', '$.a[1]');
|
|
71
|
+
→ [20]
|
|
72
|
+
SELECT json_quote(1), json_quote('text'), json_quote(null);
|
|
73
|
+
→ [{"json_quote(1)":"1","json_quote('text')":"\"text\"","json_quote(null)":"null"}]
|
|
74
|
+
SELECT json_array(1, 'two', null, json_object('x', 3));
|
|
75
|
+
→ [[1,"two",null,{"x":3}]]
|
|
76
|
+
SELECT json_object('a', 1, 'b', json_array(2, 3));
|
|
77
|
+
→ [{"a":1,"b":[2,3]}]
|
|
78
|
+
SELECT json_insert('{"a":1}', '$.b', 2);
|
|
79
|
+
→ [{"a":1,"b":2}]
|
|
80
|
+
SELECT json_replace('{"a":1, "b":2}', '$.a', 99);
|
|
81
|
+
→ [{"a":99,"b":2}]
|
|
82
|
+
SELECT json_set('{"a":1}', '$.a', 99, '$.c', 'new');
|
|
83
|
+
→ [{"a":99,"c":"new"}]
|
|
84
|
+
SELECT json_remove('{"a":1, "b":[2,3]}', '$.b[0]');
|
|
85
|
+
→ [{"a":1,"b":[3]}]
|
|
86
|
+
SELECT json_array_length('[1, 2, 3]');
|
|
87
|
+
→ [3]
|
|
88
|
+
|
|
89
|
+
-- JSON Schema Validation (using moat-maker TypeScript-like syntax)
|
|
90
|
+
-- Basic type validation
|
|
91
|
+
SELECT json_schema('42', 'number'), json_schema('42.5', 'number');
|
|
92
|
+
→ [{"json_schema('42', 'number')":true,"json_schema('42.5', 'number')":true}]
|
|
93
|
+
SELECT json_schema('"hello"', 'string'), json_schema('true', 'boolean'), json_schema('null', 'null');
|
|
94
|
+
→ [{"json_schema('\"hello\"', 'string')":true,"json_schema('true', 'boolean')":true,"json_schema('null', 'null')":true}]
|
|
95
|
+
|
|
96
|
+
-- Array validation
|
|
97
|
+
SELECT json_schema('[1, 2, 3]', 'number[]'), json_schema('[1, 2.5, 3]', 'number[]');
|
|
98
|
+
→ [{"json_schema('[1, 2, 3]', 'number[]')":true,"json_schema('[1, 2.5, 3]', 'number[]')":true}]
|
|
99
|
+
SELECT json_schema('["a", "b", "c"]', 'string[]'), json_schema('[1, "mixed"]', 'number[]');
|
|
100
|
+
→ [{"json_schema('[\"a\", \"b\", \"c\"]', 'string[]')":true,"json_schema('[1, \"mixed\"]', 'number[]')":false}]
|
|
101
|
+
|
|
102
|
+
-- Object validation
|
|
103
|
+
SELECT json_schema('{"x": 42}', '{ x: number }'), json_schema('{"x": 42, "y": 3.14}', '{ x: number, y: number }');
|
|
104
|
+
→ [{"json_schema('{\"x\": 42}', '{ x: number }')":true,"json_schema('{\"x\": 42, \"y\": 3.14}', '{ x: number, y: number }')":true}]
|
|
105
|
+
SELECT json_schema('{"x": "wrong"}', '{ x: number }'), json_schema('{"x": 42}', '{ x: number, y: number }');
|
|
106
|
+
→ [{"json_schema('{\"x\": \"wrong\"}', '{ x: number }')":false,"json_schema('{\"x\": 42}', '{ x: number, y: number }')":false}]
|
|
107
|
+
|
|
108
|
+
-- Nested structures - array of objects
|
|
109
|
+
SELECT json_schema('[{"x": 1}, {"x": 2}]', '{ x: number }[]'), json_schema('[{"x": 1}, {"x": "wrong"}]', '{ x: number }[]');
|
|
110
|
+
→ [{"json_schema('[{\"x\": 1}, {\"x\": 2}]', '{ x: number }[]')":true,"json_schema('[{\"x\": 1}, {\"x\": \"wrong\"}]', '{ x: number }[]')":false}]
|
|
111
|
+
|
|
112
|
+
-- Nested structures - object with arrays
|
|
113
|
+
SELECT json_schema('{"items": [1, 2, 3]}', '{ items: number[] }'), json_schema('{"items": [1, "wrong", 3]}', '{ items: number[] }');
|
|
114
|
+
→ [{"json_schema('{\"items\": [1, 2, 3]}', '{ items: number[] }')":true,"json_schema('{\"items\": [1, \"wrong\", 3]}', '{ items: number[] }')":false}]
|
|
115
|
+
|
|
116
|
+
-- Complex nested structure
|
|
117
|
+
SELECT json_schema('{"users": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]}', '{ users: { name: string, age: number }[] }'), json_schema('{"users": [{"name": "Alice", "age": "thirty"}]}', '{ users: { name: string, age: number }[] }');
|
|
118
|
+
→ [{"json_schema('{\"users\": [{\"name\": \"Alice\", \"age\": 30}, {\"name\": \"Bob\", \"age\": 25}]}', '{ users: { name: string, age: number }[] }')":true,"json_schema('{\"users\": [{\"name\": \"Alice\", \"age\": \"thirty\"}]}', '{ users: { name: string, age: number }[] }')":false}]
|
|
119
|
+
|
|
120
|
+
-- Invalid JSON and schema
|
|
121
|
+
SELECT json_schema('{invalid', 'number'), json_schema('42', 'unknown_type');
|
|
122
|
+
→ [{"json_schema('{invalid', 'number')":false,"json_schema('42', 'unknown_type')":false}]
|
|
123
|
+
|
|
124
|
+
-- Empty structures
|
|
125
|
+
SELECT json_schema('[]', 'number[]'), json_schema('{}', '{ x: number }'), json_schema('{}', '{}');
|
|
126
|
+
→ [{"json_schema('[]', 'number[]')":true,"json_schema('{}', '{ x: number }')":false,"json_schema('{}', '{}')":true}]
|
|
127
|
+
|
|
128
|
+
-- Use in CHECK constraint
|
|
129
|
+
CREATE TABLE events (
|
|
130
|
+
id INTEGER PRIMARY KEY,
|
|
131
|
+
data JSON CHECK (json_schema(data, '{ x: number }[]'))
|
|
132
|
+
);
|
|
133
|
+
INSERT INTO events VALUES (1, '[{"x": 1}, {"x": 2}]');
|
|
134
|
+
SELECT * FROM events;
|
|
135
|
+
→ [{"id":1,"data":[{"x":1},{"x":2}]}]
|
|
136
|
+
INSERT INTO events VALUES (2, '[{"x": "wrong"}]');
|
|
137
|
+
-- error: CHECK constraint failed
|
|
138
|
+
SELECT * FROM events;
|
|
139
|
+
→ [{"id":1,"data":[{"x":1},{"x":2}]}]
|
|
140
|
+
DROP TABLE events;
|
|
141
|
+
|
|
142
|
+
-- Aggregate JSON Functions (Need table context)
|
|
143
|
+
CREATE TABLE json_agg_t (id INT, grp TEXT, val TEXT);
|
|
144
|
+
INSERT INTO json_agg_t VALUES (1, 'A', '1'), (2, 'B', 'x'), (3, 'A', '2'), (4, 'B', 'y');
|
|
145
|
+
SELECT grp, json_group_array(val) FROM json_agg_t GROUP BY grp ORDER BY grp;
|
|
146
|
+
→ [{"grp":"A","json_group_array(val)":[1,2]},{"grp":"B","json_group_array(val)":["x","y"]}]
|
|
147
|
+
SELECT grp, json_group_object(val, id) FROM (SELECT * FROM json_agg_t) GROUP BY grp ORDER BY grp;
|
|
148
|
+
→ [{"grp":"A","json_group_object(val, id)":{"1":1,"2":3}},{"grp":"B","json_group_object(val, id)":{"x":2,"y":4}}]
|
|
149
|
+
DROP TABLE json_agg_t;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
-- string-functions.sqllogic - Testing string functions not covered in 06-builtin_functions
|
|
2
|
+
|
|
3
|
+
-- trim with custom characters
|
|
4
|
+
select trim('xxhelloxx', 'x');
|
|
5
|
+
→ [{"trim('xxhelloxx', 'x')":"hello"}]
|
|
6
|
+
|
|
7
|
+
-- ltrim and rtrim (whitespace)
|
|
8
|
+
select ltrim(' hello'), rtrim('hello ');
|
|
9
|
+
→ [{"ltrim(' hello')":"hello","rtrim('hello ')":"hello"}]
|
|
10
|
+
|
|
11
|
+
-- ltrim and rtrim with custom characters
|
|
12
|
+
select ltrim('xxhello', 'x'), rtrim('helloxx', 'x');
|
|
13
|
+
→ [{"ltrim('xxhello', 'x')":"hello","rtrim('helloxx', 'x')":"hello"}]
|
|
14
|
+
|
|
15
|
+
-- replace
|
|
16
|
+
select replace('hello world', 'world', 'quereus');
|
|
17
|
+
→ [{"replace('hello world', 'world', 'quereus')":"hello quereus"}]
|
|
18
|
+
|
|
19
|
+
-- replace with empty pattern returns original string
|
|
20
|
+
select replace('hello', '', 'x');
|
|
21
|
+
→ [{"replace('hello', '', 'x')":"hello"}]
|
|
22
|
+
|
|
23
|
+
-- instr (1-based position for found, 0 for not found)
|
|
24
|
+
select instr('hello world', 'world');
|
|
25
|
+
→ [{"instr('hello world', 'world')":7}]
|
|
26
|
+
|
|
27
|
+
select instr('hello', 'xyz');
|
|
28
|
+
→ [{"instr('hello', 'xyz')":0}]
|
|
29
|
+
|
|
30
|
+
-- instr NULL propagation
|
|
31
|
+
select instr(null, 'x'), instr('hello', null);
|
|
32
|
+
→ [{"instr(null, 'x')":null,"instr('hello', null)":null}]
|
|
33
|
+
|
|
34
|
+
-- reverse
|
|
35
|
+
select reverse('hello');
|
|
36
|
+
→ [{"reverse('hello')":"olleh"}]
|
|
37
|
+
|
|
38
|
+
-- reverse preserves characters
|
|
39
|
+
select reverse('abc');
|
|
40
|
+
→ [{"reverse('abc')":"cba"}]
|
|
41
|
+
|
|
42
|
+
-- reverse with emoji (tests Array.from handling)
|
|
43
|
+
select reverse('a😀b');
|
|
44
|
+
→ [{"reverse('a😀b')":"b😀a"}]
|
|
45
|
+
|
|
46
|
+
-- lpad
|
|
47
|
+
select lpad('hi', 5, '*');
|
|
48
|
+
→ [{"lpad('hi', 5, '*')":"***hi"}]
|
|
49
|
+
|
|
50
|
+
-- rpad
|
|
51
|
+
select rpad('hi', 5, '*');
|
|
52
|
+
→ [{"rpad('hi', 5, '*')":"hi***"}]
|
|
53
|
+
|
|
54
|
+
-- lpad with multi-char pad
|
|
55
|
+
select lpad('hi', 7, 'ab');
|
|
56
|
+
→ [{"lpad('hi', 7, 'ab')":"ababahi"}]
|
|
57
|
+
|
|
58
|
+
-- lpad when string already longer than target
|
|
59
|
+
select lpad('hello', 3, '*');
|
|
60
|
+
→ [{"lpad('hello', 3, '*')":"hello"}]
|
|
61
|
+
|
|
62
|
+
-- lpad with empty pad returns original string
|
|
63
|
+
select lpad('hi', 5, '');
|
|
64
|
+
→ [{"lpad('hi', 5, '')":"hi"}]
|
|
65
|
+
|
|
66
|
+
-- NULL propagation for string functions
|
|
67
|
+
select lower(null), upper(null), length(null), trim(null), replace(null, 'a', 'b');
|
|
68
|
+
→ [{"lower(null)":null,"upper(null)":null,"length(null)":null,"trim(null)":null,"replace(null, 'a', 'b')":null}]
|
|
69
|
+
|
|
70
|
+
-- trim with no characters to remove
|
|
71
|
+
select trim('hello', 'x');
|
|
72
|
+
→ [{"trim('hello', 'x')":"hello"}]
|
|
73
|
+
|
|
74
|
+
-- ltrim/rtrim with null
|
|
75
|
+
select ltrim(null), rtrim(null);
|
|
76
|
+
→ [{"ltrim(null)":null,"rtrim(null)":null}]
|
|
77
|
+
|
|
78
|
+
-- reverse of empty string returns empty string
|
|
79
|
+
select reverse('');
|
|
80
|
+
→ [{"reverse('')":""}]
|
|
81
|
+
|
|
82
|
+
-- replace multiple occurrences
|
|
83
|
+
select replace('aabbcc', 'b', 'x');
|
|
84
|
+
→ [{"replace('aabbcc', 'b', 'x')":"aaxxcc"}]
|
|
85
|
+
|
|
86
|
+
-- instr with empty substring
|
|
87
|
+
select instr('hello', '');
|
|
88
|
+
→ [{"instr('hello', '')":0}]
|
|
89
|
+
|
|
90
|
+
-- instr with empty string
|
|
91
|
+
select instr('', 'a');
|
|
92
|
+
→ [{"instr('', 'a')":0}]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- like-glob-edges.sqllogic - LIKE / GLOB scenarios beyond 06-builtin_functions and
|
|
2
|
+
-- 24-builtin-branches: case-sensitivity invariant, BLOB operands, GLOB character classes.
|
|
3
|
+
-- adapted from SQLite test/like.test and test/like2.test
|
|
4
|
+
-- Notes vs SQLite:
|
|
5
|
+
-- * char() builtin is not present in Quereus; multi-byte LIKE checks via char()
|
|
6
|
+
-- concatenation are dropped here.
|
|
7
|
+
-- * ESCAPE clause for LIKE is not supported; cases dropped.
|
|
8
|
+
|
|
9
|
+
-- Quereus LIKE is case-SENSITIVE by design (no PRAGMA case_sensitive_like)
|
|
10
|
+
select like('A%', 'apple') as result;
|
|
11
|
+
→ [{"result":false}]
|
|
12
|
+
|
|
13
|
+
select like('a%', 'apple') as result;
|
|
14
|
+
→ [{"result":true}]
|
|
15
|
+
|
|
16
|
+
select like('apple', 'APPLE') as result;
|
|
17
|
+
→ [{"result":false}]
|
|
18
|
+
|
|
19
|
+
-- LIKE with multi-byte UTF-8 literal: `_` should match a single character (code point), not byte
|
|
20
|
+
select like('a_b', 'aäb') as result;
|
|
21
|
+
→ [{"result":true}]
|
|
22
|
+
|
|
23
|
+
-- LIKE `_` matches a single Unicode code point (non-BMP chars count as one)
|
|
24
|
+
select like('_', '😀') as result;
|
|
25
|
+
→ [{"result":true}]
|
|
26
|
+
|
|
27
|
+
-- LIKE on numeric: assert observable behavior on a text column
|
|
28
|
+
create table like_num (id integer primary key, n integer);
|
|
29
|
+
insert into like_num values (1, 1234);
|
|
30
|
+
select like('12%', n) from like_num;
|
|
31
|
+
→ [{"like('12%', n)":true}]
|
|
32
|
+
drop table like_num;
|
|
33
|
+
|
|
34
|
+
-- GLOB is also case-sensitive
|
|
35
|
+
select glob('ABC*', 'abcdef') as result;
|
|
36
|
+
→ [{"result":false}]
|
|
37
|
+
|
|
38
|
+
select glob('abc*', 'abcdef') as result;
|
|
39
|
+
→ [{"result":true}]
|
|
40
|
+
|
|
41
|
+
-- GLOB character classes: `[abc]`, `[a-c]`, `[^abc]`
|
|
42
|
+
select glob('[abc]', 'a') as result;
|
|
43
|
+
→ [{"result":true}]
|
|
44
|
+
select glob('[abc]', 'd') as result;
|
|
45
|
+
→ [{"result":false}]
|
|
46
|
+
select glob('[a-c]', 'b') as result;
|
|
47
|
+
→ [{"result":true}]
|
|
48
|
+
select glob('[a-c]', 'd') as result;
|
|
49
|
+
→ [{"result":false}]
|
|
50
|
+
select glob('[^abc]', 'd') as result;
|
|
51
|
+
→ [{"result":true}]
|
|
52
|
+
select glob('[^abc]', 'a') as result;
|
|
53
|
+
→ [{"result":false}]
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
-- math-functions.sqllogic - Testing math functions not covered in 06-builtin_functions
|
|
2
|
+
|
|
3
|
+
-- sqrt
|
|
4
|
+
select sqrt(16), sqrt(2), sqrt(0);
|
|
5
|
+
→ [{"sqrt(16)":4,"sqrt(2)":1.4142135623730951,"sqrt(0)":0}]
|
|
6
|
+
|
|
7
|
+
-- sqrt of negative returns null
|
|
8
|
+
select sqrt(-1);
|
|
9
|
+
→ [{"sqrt(-1)":null}]
|
|
10
|
+
|
|
11
|
+
-- pow/power
|
|
12
|
+
select pow(2, 10), power(3, 3);
|
|
13
|
+
→ [{"pow(2, 10)":1024,"power(3, 3)":27}]
|
|
14
|
+
|
|
15
|
+
-- floor and ceil
|
|
16
|
+
select floor(3.7), floor(-3.7), ceil(3.2), ceiling(-3.2);
|
|
17
|
+
→ [{"floor(3.7)":3,"floor(-3.7)":-4,"ceil(3.2)":4,"ceiling(-3.2)":-3}]
|
|
18
|
+
|
|
19
|
+
-- clamp
|
|
20
|
+
select clamp(5, 1, 10), clamp(-5, 0, 100), clamp(50, 0, 10);
|
|
21
|
+
→ [{"clamp(5, 1, 10)":5,"clamp(-5, 0, 100)":0,"clamp(50, 0, 10)":10}]
|
|
22
|
+
|
|
23
|
+
-- greatest/least
|
|
24
|
+
select greatest(1, 3, 2), least(1, 3, 2);
|
|
25
|
+
→ [{"greatest(1, 3, 2)":3,"least(1, 3, 2)":1}]
|
|
26
|
+
|
|
27
|
+
-- greatest/least with strings
|
|
28
|
+
select greatest('apple', 'banana', 'cherry'), least('apple', 'banana', 'cherry');
|
|
29
|
+
→ [{"greatest('apple', 'banana', 'cherry')":"cherry","least('apple', 'banana', 'cherry')":"apple"}]
|
|
30
|
+
|
|
31
|
+
-- choose (1-based index)
|
|
32
|
+
select choose(2, 'a', 'b', 'c');
|
|
33
|
+
→ [{"choose(2, 'a', 'b', 'c')":"b"}]
|
|
34
|
+
|
|
35
|
+
-- choose out of range returns null
|
|
36
|
+
select choose(0, 'a', 'b');
|
|
37
|
+
→ [{"choose(0, 'a', 'b')":null}]
|
|
38
|
+
|
|
39
|
+
select choose(5, 'a', 'b');
|
|
40
|
+
→ [{"choose(5, 'a', 'b')":null}]
|
|
41
|
+
|
|
42
|
+
-- iif
|
|
43
|
+
select iif(1, 'yes', 'no'), iif(0, 'yes', 'no'), iif(null, 'yes', 'no');
|
|
44
|
+
→ [{"iif(1, 'yes', 'no')":"yes","iif(0, 'yes', 'no')":"no","iif(null, 'yes', 'no')":"no"}]
|
|
45
|
+
|
|
46
|
+
-- random returns integer type
|
|
47
|
+
select typeof(random());
|
|
48
|
+
→ [{"typeof(random())":"integer"}]
|
|
49
|
+
|
|
50
|
+
-- NULL propagation for math (through table columns, historically to avoid the plan-time
|
|
51
|
+
-- argument-type gate — a NULL-typed literal now passes it, see
|
|
52
|
+
-- 06.5.3-undeclared-return-type-comparison § 6)
|
|
53
|
+
create table null_math (id integer primary key, v real null);
|
|
54
|
+
insert into null_math values (1, null);
|
|
55
|
+
select abs(v), round(v), sqrt(v), pow(v, 2), floor(v), ceil(v) from null_math;
|
|
56
|
+
→ [{"abs(v)":null,"round(v)":null,"sqrt(v)":null,"pow(v, 2)":null,"floor(v)":null,"ceil(v)":null}]
|
|
57
|
+
drop table null_math;
|
|
58
|
+
|
|
59
|
+
-- pow with zero exponent
|
|
60
|
+
select pow(5, 0), pow(0, 0);
|
|
61
|
+
→ [{"pow(5, 0)":1,"pow(0, 0)":1}]
|
|
62
|
+
|
|
63
|
+
-- floor/ceil with integers (no change)
|
|
64
|
+
select floor(5), ceil(5);
|
|
65
|
+
→ [{"floor(5)":5,"ceil(5)":5}]
|
|
66
|
+
|
|
67
|
+
-- clamp with null (through table column). Propagates NULL like every other math function
|
|
68
|
+
-- above; this asserted 0 until clamp got an explicit null short-circuit, because its three
|
|
69
|
+
-- arguments reach Number() together and Number(null) is 0, which returned the lower bound.
|
|
70
|
+
create table null_clamp (id integer primary key, v real null);
|
|
71
|
+
insert into null_clamp values (1, null);
|
|
72
|
+
select clamp(v, 0, 10) from null_clamp;
|
|
73
|
+
→ [{"clamp(v, 0, 10)":null}]
|
|
74
|
+
drop table null_clamp;
|
|
75
|
+
|
|
76
|
+
-- greatest/least with single argument
|
|
77
|
+
select greatest(42), least(42);
|
|
78
|
+
→ [{"greatest(42)":42,"least(42)":42}]
|
|
79
|
+
|
|
80
|
+
-- pow with negative exponent
|
|
81
|
+
select pow(2, -1);
|
|
82
|
+
→ [{"pow(2, -1)":0.5}]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
-- schema-indexes.sqllogic - Testing schema() introspection for indexes
|
|
2
|
+
--
|
|
3
|
+
-- requires-capability: standalone-index-ddl
|
|
4
|
+
|
|
5
|
+
CREATE TABLE products (
|
|
6
|
+
id INTEGER PRIMARY KEY,
|
|
7
|
+
name TEXT,
|
|
8
|
+
category TEXT
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
CREATE INDEX idx_category ON products(category);
|
|
12
|
+
|
|
13
|
+
CREATE INDEX idx_name ON products(name);
|
|
14
|
+
|
|
15
|
+
-- Verify indexes are returned in schema()
|
|
16
|
+
SELECT type, name, tbl_name, sql FROM schema() WHERE type = 'index' ORDER BY name;
|
|
17
|
+
→ [{"type":"index","name":"idx_category","tbl_name":"products","sql":"CREATE INDEX \"idx_category\" ON \"main\".\"products\" (\"category\" COLLATE BINARY)"},{"type":"index","name":"idx_name","tbl_name":"products","sql":"CREATE INDEX \"idx_name\" ON \"main\".\"products\" (\"name\" COLLATE BINARY)"}]
|
|
18
|
+
|
|
19
|
+
-- Verify 'index' is in the list of schema object types
|
|
20
|
+
SELECT DISTINCT type FROM schema() ORDER BY type;
|
|
21
|
+
→ [{"type":"function"},{"type":"index"},{"type":"table"}]
|
|
22
|
+
|
|
23
|
+
-- Test with composite index
|
|
24
|
+
CREATE TABLE orders (
|
|
25
|
+
id INTEGER PRIMARY KEY,
|
|
26
|
+
customer_id INTEGER,
|
|
27
|
+
status TEXT
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
CREATE INDEX idx_customer_status ON orders(customer_id, status);
|
|
31
|
+
|
|
32
|
+
SELECT name, tbl_name, sql FROM schema() WHERE type = 'index' AND tbl_name = 'orders';
|
|
33
|
+
→ [{"name":"idx_customer_status","tbl_name":"orders","sql":"CREATE INDEX \"idx_customer_status\" ON \"main\".\"orders\" (\"customer_id\" COLLATE BINARY, \"status\" COLLATE BINARY)"}]
|
|
34
|
+
|
|
35
|
+
-- Test with DESC index
|
|
36
|
+
CREATE TABLE events (
|
|
37
|
+
id INTEGER PRIMARY KEY,
|
|
38
|
+
created_at TEXT
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
CREATE INDEX idx_created_desc ON events(created_at DESC);
|
|
42
|
+
|
|
43
|
+
SELECT sql FROM schema() WHERE type = 'index' AND name = 'idx_created_desc';
|
|
44
|
+
→ [{"sql":"CREATE INDEX \"idx_created_desc\" ON \"main\".\"events\" (\"created_at\" COLLATE BINARY DESC)"}]
|
|
45
|
+
|
|
46
|
+
-- The view-shaped schema() assertions (view row, view sql preserved, 'view' in the
|
|
47
|
+
-- type list) need no index and live in 06.3.6-schema-views, so a backend that skips
|
|
48
|
+
-- this file over its index DDL still runs them.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
-- Schema() TVF: schema column and non-default schema enumeration
|
|
2
|
+
|
|
3
|
+
-- Setup: create a table in main
|
|
4
|
+
CREATE TABLE main_t (id INTEGER PRIMARY KEY, val TEXT);
|
|
5
|
+
|
|
6
|
+
-- Test 1: schema column exists and shows 'main' for main-schema objects
|
|
7
|
+
SELECT schema, type, name FROM schema() WHERE name = 'main_t';
|
|
8
|
+
→ [{"schema":"main","type":"table","name":"main_t"}]
|
|
9
|
+
|
|
10
|
+
-- Test 2: all rows have a non-null schema column
|
|
11
|
+
SELECT count(*) as bad FROM schema() WHERE schema IS NULL;
|
|
12
|
+
→ [{"bad":0}]
|
|
13
|
+
|
|
14
|
+
-- Test 3: create a non-default schema with a table, verify it appears
|
|
15
|
+
declare schema myschema {
|
|
16
|
+
table other_t {
|
|
17
|
+
id INTEGER PRIMARY KEY,
|
|
18
|
+
label TEXT
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
apply schema myschema;
|
|
23
|
+
|
|
24
|
+
-- run
|
|
25
|
+
|
|
26
|
+
SELECT schema, type, name FROM schema() WHERE name = 'other_t';
|
|
27
|
+
→ [{"schema":"myschema","type":"table","name":"other_t"}]
|
|
28
|
+
|
|
29
|
+
-- Test 4: both main and myschema tables appear together
|
|
30
|
+
SELECT schema, name FROM schema() WHERE type = 'table' AND name IN ('main_t', 'other_t') ORDER BY schema, name;
|
|
31
|
+
→ [{"schema":"main","name":"main_t"},{"schema":"myschema","name":"other_t"}]
|
|
32
|
+
|
|
33
|
+
-- Test 5: functions from all schemas appear (built-in functions are in main)
|
|
34
|
+
SELECT DISTINCT schema FROM schema() WHERE type = 'function' ORDER BY schema;
|
|
35
|
+
→ [{"schema":"main"}]
|
|
36
|
+
|
|
37
|
+
-- Cleanup
|
|
38
|
+
DROP TABLE main_t;
|
|
39
|
+
DROP TABLE myschema.other_t;
|