@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,169 @@
|
|
|
1
|
+
-- polymorphic-types.sqllogic - Testing polymorphic function type inference
|
|
2
|
+
|
|
3
|
+
-- Test abs() with INTEGER and REAL types
|
|
4
|
+
CREATE TABLE test_abs (id INTEGER PRIMARY KEY, int_val INTEGER, real_val REAL);
|
|
5
|
+
INSERT INTO test_abs VALUES (1, -42, -2.5);
|
|
6
|
+
|
|
7
|
+
SELECT abs(int_val) as result FROM test_abs;
|
|
8
|
+
→ [{"result": 42}]
|
|
9
|
+
|
|
10
|
+
SELECT abs(real_val) as result FROM test_abs;
|
|
11
|
+
→ [{"result": 2.5}]
|
|
12
|
+
|
|
13
|
+
DROP TABLE test_abs;
|
|
14
|
+
|
|
15
|
+
-- Test coalesce() type inference
|
|
16
|
+
SELECT coalesce(NULL, 42) as result;
|
|
17
|
+
→ [{"result": 42}]
|
|
18
|
+
|
|
19
|
+
-- Test greatest() and least()
|
|
20
|
+
CREATE TABLE test_minmax (id INTEGER PRIMARY KEY, a INTEGER, b INTEGER, c INTEGER);
|
|
21
|
+
INSERT INTO test_minmax VALUES (1, 10, 42, 25);
|
|
22
|
+
|
|
23
|
+
SELECT greatest(a, b, c) as result FROM test_minmax;
|
|
24
|
+
→ [{"result": 42}]
|
|
25
|
+
|
|
26
|
+
SELECT least(a, b, c) as result FROM test_minmax;
|
|
27
|
+
→ [{"result": 10}]
|
|
28
|
+
|
|
29
|
+
DROP TABLE test_minmax;
|
|
30
|
+
|
|
31
|
+
-- Test MIN() and MAX() aggregates
|
|
32
|
+
CREATE TABLE test_agg (id INTEGER PRIMARY KEY, int_val INTEGER NULL, real_val REAL NULL);
|
|
33
|
+
INSERT INTO test_agg VALUES (1, 42, NULL), (2, 10, NULL), (3, 25, NULL);
|
|
34
|
+
INSERT INTO test_agg VALUES (4, NULL, 3.5), (5, NULL, 2.5), (6, NULL, 1.5);
|
|
35
|
+
|
|
36
|
+
SELECT MIN(int_val) as result FROM test_agg;
|
|
37
|
+
→ [{"result": 10}]
|
|
38
|
+
|
|
39
|
+
SELECT MAX(int_val) as result FROM test_agg;
|
|
40
|
+
→ [{"result": 42}]
|
|
41
|
+
|
|
42
|
+
SELECT MAX(real_val) as result FROM test_agg;
|
|
43
|
+
→ [{"result": 3.5}]
|
|
44
|
+
|
|
45
|
+
DROP TABLE test_agg;
|
|
46
|
+
|
|
47
|
+
-- Test common type resolution for coalesce()
|
|
48
|
+
SELECT coalesce(NULL, 42, 2.5) as result;
|
|
49
|
+
→ [{"result": 42}]
|
|
50
|
+
|
|
51
|
+
-- Test common type resolution for iif()
|
|
52
|
+
SELECT iif(1, 42, 2.5) as result;
|
|
53
|
+
→ [{"result": 42}]
|
|
54
|
+
|
|
55
|
+
SELECT iif(0, 42, 2.5) as result;
|
|
56
|
+
→ [{"result": 2.5}]
|
|
57
|
+
|
|
58
|
+
-- Test common type resolution for greatest() and least()
|
|
59
|
+
SELECT greatest(10, 2.5, 42) as result;
|
|
60
|
+
→ [{"result": 42}]
|
|
61
|
+
|
|
62
|
+
SELECT least(10, 2.5, 42) as result;
|
|
63
|
+
→ [{"result": 2.5}]
|
|
64
|
+
|
|
65
|
+
-- Test common type resolution for choose()
|
|
66
|
+
SELECT choose(1, 42, 2.5, 100) as result;
|
|
67
|
+
→ [{"result": 42}]
|
|
68
|
+
|
|
69
|
+
SELECT choose(2, 42, 2.5, 100) as result;
|
|
70
|
+
→ [{"result": 2.5}]
|
|
71
|
+
|
|
72
|
+
-- Test scalar function type inference
|
|
73
|
+
SELECT round(42) as result;
|
|
74
|
+
→ [{"result": 42}]
|
|
75
|
+
|
|
76
|
+
SELECT round(2.5) as result;
|
|
77
|
+
→ [{"result": 3}]
|
|
78
|
+
|
|
79
|
+
SELECT nullif(42, 0) as result;
|
|
80
|
+
→ [{"result": 42}]
|
|
81
|
+
|
|
82
|
+
SELECT nullif(42, 42) as result;
|
|
83
|
+
→ [{"result": null}]
|
|
84
|
+
|
|
85
|
+
SELECT sqrt(16.0) as result;
|
|
86
|
+
→ [{"result": 4}]
|
|
87
|
+
|
|
88
|
+
SELECT floor(2.5) as result;
|
|
89
|
+
→ [{"result": 2}]
|
|
90
|
+
|
|
91
|
+
SELECT ceil(2.5) as result;
|
|
92
|
+
→ [{"result": 3}]
|
|
93
|
+
|
|
94
|
+
SELECT clamp(50, 0, 100) as result;
|
|
95
|
+
→ [{"result": 50}]
|
|
96
|
+
|
|
97
|
+
SELECT clamp(-10, 0, 100) as result;
|
|
98
|
+
→ [{"result": 0}]
|
|
99
|
+
|
|
100
|
+
SELECT clamp(150, 0, 100) as result;
|
|
101
|
+
→ [{"result": 100}]
|
|
102
|
+
|
|
103
|
+
-- Test string function type inference
|
|
104
|
+
SELECT length('hello') as result;
|
|
105
|
+
→ [{"result": 5}]
|
|
106
|
+
|
|
107
|
+
SELECT upper('hello') as result;
|
|
108
|
+
→ [{"result": "HELLO"}]
|
|
109
|
+
|
|
110
|
+
SELECT lower('HELLO') as result;
|
|
111
|
+
→ [{"result": "hello"}]
|
|
112
|
+
|
|
113
|
+
SELECT trim(' hello ') as result;
|
|
114
|
+
→ [{"result": "hello"}]
|
|
115
|
+
|
|
116
|
+
SELECT substr('hello', 1, 3) as result;
|
|
117
|
+
→ [{"result": "hel"}]
|
|
118
|
+
|
|
119
|
+
SELECT replace('hello', 'l', 'L') as result;
|
|
120
|
+
→ [{"result": "heLLo"}]
|
|
121
|
+
|
|
122
|
+
SELECT instr('hello', 'l') as result;
|
|
123
|
+
→ [{"result": 3}]
|
|
124
|
+
|
|
125
|
+
-- Test arithmetic operator type inference
|
|
126
|
+
-- INTEGER + INTEGER -> INTEGER
|
|
127
|
+
SELECT 10 + 20 as result;
|
|
128
|
+
→ [{"result": 30}]
|
|
129
|
+
|
|
130
|
+
-- INTEGER + REAL -> REAL
|
|
131
|
+
SELECT 10 + 2.5 as result;
|
|
132
|
+
→ [{"result": 12.5}]
|
|
133
|
+
|
|
134
|
+
-- REAL + INTEGER -> REAL
|
|
135
|
+
SELECT 2.5 + 10 as result;
|
|
136
|
+
→ [{"result": 12.5}]
|
|
137
|
+
|
|
138
|
+
-- REAL + REAL -> REAL
|
|
139
|
+
SELECT 2.5 + 3.5 as result;
|
|
140
|
+
→ [{"result": 6}]
|
|
141
|
+
|
|
142
|
+
-- INTEGER * INTEGER -> INTEGER
|
|
143
|
+
SELECT 10 * 20 as result;
|
|
144
|
+
→ [{"result": 200}]
|
|
145
|
+
|
|
146
|
+
-- INTEGER * REAL -> REAL
|
|
147
|
+
SELECT 10 * 2.5 as result;
|
|
148
|
+
→ [{"result": 25}]
|
|
149
|
+
|
|
150
|
+
-- INTEGER - INTEGER -> INTEGER
|
|
151
|
+
SELECT 20 - 10 as result;
|
|
152
|
+
→ [{"result": 10}]
|
|
153
|
+
|
|
154
|
+
-- REAL - INTEGER -> REAL
|
|
155
|
+
SELECT 12.5 - 10 as result;
|
|
156
|
+
→ [{"result": 2.5}]
|
|
157
|
+
|
|
158
|
+
-- INTEGER / INTEGER -> INTEGER
|
|
159
|
+
SELECT 20 / 10 as result;
|
|
160
|
+
→ [{"result": 2}]
|
|
161
|
+
|
|
162
|
+
-- REAL / INTEGER -> REAL
|
|
163
|
+
SELECT 10.0 / 2 as result;
|
|
164
|
+
→ [{"result": 5}]
|
|
165
|
+
|
|
166
|
+
-- INTEGER % INTEGER -> INTEGER
|
|
167
|
+
SELECT 23 % 10 as result;
|
|
168
|
+
→ [{"result": 3}]
|
|
169
|
+
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
-- conversion-functions.sqllogic - Testing type conversion functions
|
|
2
|
+
|
|
3
|
+
-- integer conversion
|
|
4
|
+
select integer(42), integer('123'), integer(3.14), integer(true), integer(false);
|
|
5
|
+
→ [{"integer(42)":42,"integer('123')":123,"integer(3.14)":3,"integer(true)":1,"integer(false)":0}]
|
|
6
|
+
|
|
7
|
+
-- integer null
|
|
8
|
+
select integer(null);
|
|
9
|
+
→ [{"integer(null)":null}]
|
|
10
|
+
|
|
11
|
+
-- real conversion
|
|
12
|
+
select real(42), real('3.14');
|
|
13
|
+
→ [{"real(42)":42,"real('3.14')":3.14}]
|
|
14
|
+
|
|
15
|
+
-- text conversion
|
|
16
|
+
select text(42), text(3.14), text(true), text(null);
|
|
17
|
+
→ [{"text(42)":"42","text(3.14)":"3.14","text(true)":"true","text(null)":null}]
|
|
18
|
+
|
|
19
|
+
-- boolean conversion
|
|
20
|
+
select boolean(1), boolean(0), boolean('true'), boolean('false');
|
|
21
|
+
→ [{"boolean(1)":true,"boolean(0)":false,"boolean('true')":true,"boolean('false')":false}]
|
|
22
|
+
|
|
23
|
+
-- real null
|
|
24
|
+
select real(null);
|
|
25
|
+
→ [{"real(null)":null}]
|
|
26
|
+
|
|
27
|
+
-- boolean null
|
|
28
|
+
select boolean(null);
|
|
29
|
+
→ [{"boolean(null)":null}]
|
|
30
|
+
|
|
31
|
+
-- integer from negative
|
|
32
|
+
select integer(-5), integer('-10');
|
|
33
|
+
→ [{"integer(-5)":-5,"integer('-10')":-10}]
|
|
34
|
+
|
|
35
|
+
-- real from integer string
|
|
36
|
+
select real('42');
|
|
37
|
+
→ [{"real('42')":42}]
|
|
38
|
+
|
|
39
|
+
-- =============================================================================
|
|
40
|
+
-- blob() -- literal UTF-8, no hex sniffing
|
|
41
|
+
-- =============================================================================
|
|
42
|
+
|
|
43
|
+
select blob('abc') = x'616263' as r;
|
|
44
|
+
→ [{"r":true}]
|
|
45
|
+
|
|
46
|
+
-- Even a string that looks like hex digits still becomes its literal UTF-8 bytes.
|
|
47
|
+
select blob('6162') = x'36313632' as r;
|
|
48
|
+
→ [{"r":true}]
|
|
49
|
+
|
|
50
|
+
select blob(null);
|
|
51
|
+
→ [{"blob(null)":null}]
|
|
52
|
+
|
|
53
|
+
select typeof(blob('abc'));
|
|
54
|
+
→ [{"typeof(blob('abc'))":"blob"}]
|
|
55
|
+
|
|
56
|
+
-- A number or boolean renders through the one value-to-text rule, then takes
|
|
57
|
+
-- those bytes -- blob(42) is the two digits of '42', not the byte 0x2a.
|
|
58
|
+
select blob(42) = x'3432' as r;
|
|
59
|
+
→ [{"r":true}]
|
|
60
|
+
|
|
61
|
+
select blob(true) = x'74727565' as r;
|
|
62
|
+
→ [{"r":true}]
|
|
63
|
+
|
|
64
|
+
-- A conversion function is strict where CAST is lenient: blob() rejects a JSON
|
|
65
|
+
-- document, while cast(<json> as blob) yields the document's own text as bytes.
|
|
66
|
+
select blob(json('{"a":1}'));
|
|
67
|
+
-- error: Cannot convert to BLOB
|
|
68
|
+
|
|
69
|
+
select cast(json('{"a":1}') as blob) = x'7b2261223a317d' as r;
|
|
70
|
+
→ [{"r":true}]
|
|
71
|
+
|
|
72
|
+
-- =============================================================================
|
|
73
|
+
-- hex() / unhex()
|
|
74
|
+
-- =============================================================================
|
|
75
|
+
|
|
76
|
+
select hex(x'6162');
|
|
77
|
+
→ [{"hex(x'6162')":"6162"}]
|
|
78
|
+
|
|
79
|
+
-- hex() is uppercase, no separator.
|
|
80
|
+
select hex(x'cafe');
|
|
81
|
+
→ [{"hex(x'cafe')":"CAFE"}]
|
|
82
|
+
|
|
83
|
+
-- A non-blob argument converts to bytes first, same path as cast(X as blob).
|
|
84
|
+
select hex('abc');
|
|
85
|
+
→ [{"hex('abc')":"616263"}]
|
|
86
|
+
|
|
87
|
+
-- Same for a number or a boolean: the bytes are the value's text spelling, so
|
|
88
|
+
-- hex(42) is the hex of '4','2' -- not the hex of the integer 42.
|
|
89
|
+
select hex(42);
|
|
90
|
+
→ [{"hex(42)":"3432"}]
|
|
91
|
+
|
|
92
|
+
select hex(true);
|
|
93
|
+
→ [{"hex(true)":"74727565"}]
|
|
94
|
+
|
|
95
|
+
-- Strict like blob(), for the same reason: hex() is the blob conversion plus a
|
|
96
|
+
-- spelling, so a JSON document raises rather than answering NULL.
|
|
97
|
+
select hex(json('{"a":1}'));
|
|
98
|
+
-- error: Cannot convert to BLOB for hex()
|
|
99
|
+
|
|
100
|
+
select hex(null);
|
|
101
|
+
→ [{"hex(null)":null}]
|
|
102
|
+
|
|
103
|
+
-- Empty blob is a distinct non-null zero-length value, not null.
|
|
104
|
+
select hex(x'');
|
|
105
|
+
→ [{"hex(x'')":""}]
|
|
106
|
+
|
|
107
|
+
select unhex('6162') = x'6162' as r;
|
|
108
|
+
→ [{"r":true}]
|
|
109
|
+
|
|
110
|
+
-- Case-insensitive input.
|
|
111
|
+
select unhex('CAFE') = unhex('cafe') as r;
|
|
112
|
+
→ [{"r":true}]
|
|
113
|
+
|
|
114
|
+
-- Odd number of hex digits -> null, not an error.
|
|
115
|
+
select unhex('616');
|
|
116
|
+
→ [{"unhex('616')":null}]
|
|
117
|
+
|
|
118
|
+
-- Non-hex characters -> null.
|
|
119
|
+
select unhex('zz');
|
|
120
|
+
→ [{"unhex('zz')":null}]
|
|
121
|
+
|
|
122
|
+
select unhex(null);
|
|
123
|
+
→ [{"unhex(null)":null}]
|
|
124
|
+
|
|
125
|
+
-- unhex() reads text only. Anything else -- a number, a blob -- is NULL, not an
|
|
126
|
+
-- error and not a conversion: unhex(x'6162') does NOT round-trip hex(x'6162').
|
|
127
|
+
select unhex(42);
|
|
128
|
+
→ [{"unhex(42)":null}]
|
|
129
|
+
|
|
130
|
+
select unhex(x'6162');
|
|
131
|
+
→ [{"unhex(x'6162')":null}]
|
|
132
|
+
|
|
133
|
+
-- Empty string unhexes to the empty blob, not null.
|
|
134
|
+
select unhex('') = x'' as r, unhex('') is null as isnull;
|
|
135
|
+
→ [{"r":true,"isnull":false}]
|
|
136
|
+
|
|
137
|
+
-- Round trip through hex()/unhex().
|
|
138
|
+
select unhex(hex(x'deadbeef')) = x'deadbeef' as r;
|
|
139
|
+
→ [{"r":true}]
|
|
140
|
+
|
|
141
|
+
-- =============================================================================
|
|
142
|
+
-- Text-into-BLOB-column write/read-back
|
|
143
|
+
-- =============================================================================
|
|
144
|
+
|
|
145
|
+
create table blob_write_test (id integer primary key, data blob);
|
|
146
|
+
|
|
147
|
+
insert into blob_write_test values (1, cast('abc' as blob));
|
|
148
|
+
select id, data = x'616263' as r from blob_write_test where id = 1;
|
|
149
|
+
→ [{"id":1,"r":true}]
|
|
150
|
+
|
|
151
|
+
insert into blob_write_test values (2, cast('6162' as blob));
|
|
152
|
+
select id, data = x'36313632' as r from blob_write_test where id = 2;
|
|
153
|
+
→ [{"id":2,"r":true}]
|
|
154
|
+
|
|
155
|
+
drop table blob_write_test;
|
|
156
|
+
|
|
157
|
+
-- The ALTER retype backfill converts existing rows through the same
|
|
158
|
+
-- BLOB_TYPE.parse the INSERT path uses, so a hex-shaped stored string must come
|
|
159
|
+
-- back as its own UTF-8 bytes rather than being decoded as hex digits.
|
|
160
|
+
create table blob_retype_test (id integer primary key, v text);
|
|
161
|
+
insert into blob_retype_test values (1, 'abc'), (2, '6162');
|
|
162
|
+
-- run
|
|
163
|
+
|
|
164
|
+
alter table blob_retype_test alter column v set data type blob;
|
|
165
|
+
-- run
|
|
166
|
+
|
|
167
|
+
select id, v = x'616263' as r from blob_retype_test where id = 1;
|
|
168
|
+
→ [{"id":1,"r":true}]
|
|
169
|
+
|
|
170
|
+
select id, v = x'36313632' as r from blob_retype_test where id = 2;
|
|
171
|
+
→ [{"id":2,"r":true}]
|
|
172
|
+
|
|
173
|
+
drop table blob_retype_test;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- adapted from SQLite test/minmax.test
|
|
2
|
+
-- Scalar MIN(x, y, ...) / MAX(x, y, ...) — distinguished from single-arg aggregates by arity.
|
|
3
|
+
-- Quereus does not currently implement multi-argument scalar min/max; only the
|
|
4
|
+
-- single-arg aggregate forms exist. Document the rejection.
|
|
5
|
+
|
|
6
|
+
select min(10, 20);
|
|
7
|
+
-- error: Function not found: min/2
|
|
8
|
+
|
|
9
|
+
select max(10, 20);
|
|
10
|
+
-- error: Function not found: max/2
|
|
11
|
+
|
|
12
|
+
select min(10, 20, 5);
|
|
13
|
+
-- error: Function not found: min/3
|
|
14
|
+
|
|
15
|
+
select max(10, 20, 5);
|
|
16
|
+
-- error: Function not found: max/3
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
-- undeclared-return-type-comparison.sqllogic
|
|
2
|
+
-- A function registered without a declared `returnType` reports ANY (unknown), not REAL.
|
|
3
|
+
-- While the default was REAL, the planner believed every such function returned a number,
|
|
4
|
+
-- so `insertCrossTypeCoercion` cast the TEXT side of a comparison to REAL — the literal
|
|
5
|
+
-- 'object' became 0 and `json_type(j) = 'object'` was FALSE. At the time, most builtins
|
|
6
|
+
-- declared no return type (all of datetime.ts, nearly all of json.ts and string.ts), so
|
|
7
|
+
-- the whole family was affected; ticket 1-scalar-function-default-return-type-any.
|
|
8
|
+
--
|
|
9
|
+
-- Those builtins now declare their real return types (ticket
|
|
10
|
+
-- 2-builtin-scalar-function-declared-return-types), so most of the cases below reach the
|
|
11
|
+
-- right answer by a shorter route than ANY. `json_extract` is the one builtin still
|
|
12
|
+
-- deliberately ANY — genuinely polymorphic — so the ANY behavior stays exercised here.
|
|
13
|
+
--
|
|
14
|
+
-- The user-defined-function half of this (Database.createScalarFunction never passes a
|
|
15
|
+
-- returnType) lives in test/core-api-features.spec.ts — a .sqllogic file cannot register
|
|
16
|
+
-- one.
|
|
17
|
+
--
|
|
18
|
+
-- No `using memory`, so store mode exercises the persisted path too.
|
|
19
|
+
|
|
20
|
+
create table urt (id integer primary key, j json, d text, n integer);
|
|
21
|
+
insert into urt values (1, '{"a":"x"}', '2024-03-04', 5);
|
|
22
|
+
-- run
|
|
23
|
+
|
|
24
|
+
-- ===================================
|
|
25
|
+
-- 1. The reproducing comparisons — every one of these was FALSE
|
|
26
|
+
-- ===================================
|
|
27
|
+
select json_type(j) = 'object' as r from urt;
|
|
28
|
+
→ [{"r":true}]
|
|
29
|
+
|
|
30
|
+
select json_extract(j, '$.a') = 'x' as r from urt;
|
|
31
|
+
→ [{"r":true}]
|
|
32
|
+
|
|
33
|
+
select strftime('%Y', d) = '2024' as r from urt;
|
|
34
|
+
→ [{"r":true}]
|
|
35
|
+
|
|
36
|
+
-- json_quote returns the JSON source as TEXT, so this compares two plain strings.
|
|
37
|
+
select json_quote(j) = '{"a":"x"}' as r from urt;
|
|
38
|
+
→ [{"r":true}]
|
|
39
|
+
|
|
40
|
+
-- Literal on the LEFT is the same coercion, mirrored.
|
|
41
|
+
select 'object' = json_type(j) as r from urt;
|
|
42
|
+
→ [{"r":true}]
|
|
43
|
+
|
|
44
|
+
-- The complement is honest too (it was TRUE for every row before).
|
|
45
|
+
select json_type(j) <> 'object' as r from urt;
|
|
46
|
+
→ [{"r":false}]
|
|
47
|
+
|
|
48
|
+
-- Unequal text is still unequal — the fix is not "always true".
|
|
49
|
+
select json_type(j) = 'array' as r from urt;
|
|
50
|
+
→ [{"r":false}]
|
|
51
|
+
|
|
52
|
+
-- WHERE position, not just the select list.
|
|
53
|
+
select id from urt where json_type(j) = 'object';
|
|
54
|
+
→ [{"id":1}]
|
|
55
|
+
|
|
56
|
+
select id from urt where strftime('%Y', d) = '2024';
|
|
57
|
+
→ [{"id":1}]
|
|
58
|
+
|
|
59
|
+
-- ===================================
|
|
60
|
+
-- 2. The other comparison sites agree with `=`
|
|
61
|
+
-- ===================================
|
|
62
|
+
select json_type(j) in ('object') as r from urt;
|
|
63
|
+
→ [{"r":true}]
|
|
64
|
+
|
|
65
|
+
select case json_type(j) when 'object' then 'yes' else 'no' end as r from urt;
|
|
66
|
+
→ [{"r":"yes"}]
|
|
67
|
+
|
|
68
|
+
select json_type(j) between 'a' and 'z' as r from urt;
|
|
69
|
+
→ [{"r":true}]
|
|
70
|
+
|
|
71
|
+
select json_type(j) like 'obj%' as r from urt;
|
|
72
|
+
→ [{"r":true}]
|
|
73
|
+
|
|
74
|
+
-- An ANY-typed value against a number is simply unequal, not an error.
|
|
75
|
+
select json_type(j) = 3 as r from urt;
|
|
76
|
+
→ [{"r":false}]
|
|
77
|
+
|
|
78
|
+
-- ===================================
|
|
79
|
+
-- 3. A non-JSON operand vs JSON still takes the object-physical arm of insertCrossTypeCoercion
|
|
80
|
+
-- ===================================
|
|
81
|
+
-- Neither ANY nor TEXT is NULL, so the arm is not skipped: the non-JSON side is cast to
|
|
82
|
+
-- JSON. 'object' is not JSON source, so the lenient cast leaves it as the raw string,
|
|
83
|
+
-- which does not equal the object {"a":"x"}. Pinned deliberately.
|
|
84
|
+
select json_type(j) = j as r from urt;
|
|
85
|
+
→ [{"r":false}]
|
|
86
|
+
|
|
87
|
+
-- Same shape with a still-ANY operand (json_extract), so the ANY arm stays covered.
|
|
88
|
+
select json_extract(j, '$.a') = j as r from urt;
|
|
89
|
+
→ [{"r":false}]
|
|
90
|
+
|
|
91
|
+
-- The JSON source text spelled by json_quote DOES parse, so it matches structurally.
|
|
92
|
+
select json_quote(j) = j as r from urt;
|
|
93
|
+
→ [{"r":true}]
|
|
94
|
+
|
|
95
|
+
-- ===================================
|
|
96
|
+
-- 4. json_type's value still works everywhere else it has always worked
|
|
97
|
+
-- ===================================
|
|
98
|
+
select json_type(j) || '!' as r from urt;
|
|
99
|
+
→ [{"r":"object!"}]
|
|
100
|
+
|
|
101
|
+
select length(json_type(j)) as r from urt;
|
|
102
|
+
→ [{"r":6}]
|
|
103
|
+
|
|
104
|
+
select coalesce(json_type(j), 'none') as r from urt;
|
|
105
|
+
→ [{"r":"object"}]
|
|
106
|
+
|
|
107
|
+
select nullif(json_type(j), 'object') as r from urt;
|
|
108
|
+
→ [{"r":null}]
|
|
109
|
+
|
|
110
|
+
select cast(json_type(j) as text) = 'object' as r from urt;
|
|
111
|
+
→ [{"r":true}]
|
|
112
|
+
|
|
113
|
+
select typeof(json_type(j)) as r from urt;
|
|
114
|
+
→ [{"r":"text"}]
|
|
115
|
+
|
|
116
|
+
-- Identity sites (ORDER BY / GROUP BY / DISTINCT / min / max) rank the value as text,
|
|
117
|
+
-- as they always did.
|
|
118
|
+
insert into urt values (2, '[1]', '2023-01-02', 7);
|
|
119
|
+
-- run
|
|
120
|
+
|
|
121
|
+
select json_type(j) as r from urt order by json_type(j);
|
|
122
|
+
→ [{"r":"array"},{"r":"object"}]
|
|
123
|
+
|
|
124
|
+
select min(json_type(j)) as mn, max(json_type(j)) as mx from urt;
|
|
125
|
+
→ [{"mn":"array","mx":"object"}]
|
|
126
|
+
|
|
127
|
+
select json_type(j) as g, count(*) as c from urt group by json_type(j) order by g;
|
|
128
|
+
→ [{"g":"array","c":1},{"g":"object","c":1}]
|
|
129
|
+
|
|
130
|
+
select count(*) as c from (select distinct json_type(j) from urt);
|
|
131
|
+
→ [{"c":2}]
|
|
132
|
+
|
|
133
|
+
-- ===================================
|
|
134
|
+
-- 5. The numeric builtins accept an unclassifiable argument
|
|
135
|
+
-- ===================================
|
|
136
|
+
-- abs/round/sqrt/floor/ceil/clamp gate their argument at plan time on isNumeric. With an
|
|
137
|
+
-- honest ANY default that gate has to mean "numeric, or not yet known"
|
|
138
|
+
-- (isNumericOrUnknownType) or `abs(<undeclared function>)` becomes unusable.
|
|
139
|
+
select abs(json_extract(j, '$.a')) as r from urt where id = 1;
|
|
140
|
+
→ [{"r":null}]
|
|
141
|
+
|
|
142
|
+
-- ===================================
|
|
143
|
+
-- 6. NULL passes the same gate: abs(null) is null in SQL, not an error
|
|
144
|
+
-- ===================================
|
|
145
|
+
-- These all threw "Invalid argument types for function <name>" before, including at HEAD
|
|
146
|
+
-- before the default changed.
|
|
147
|
+
select abs(null) as r;
|
|
148
|
+
→ [{"r":null}]
|
|
149
|
+
|
|
150
|
+
select round(null) as r;
|
|
151
|
+
→ [{"r":null}]
|
|
152
|
+
|
|
153
|
+
select round(null, 1) as r;
|
|
154
|
+
→ [{"r":null}]
|
|
155
|
+
|
|
156
|
+
select sqrt(null) as r;
|
|
157
|
+
→ [{"r":null}]
|
|
158
|
+
|
|
159
|
+
select floor(null) as r;
|
|
160
|
+
→ [{"r":null}]
|
|
161
|
+
|
|
162
|
+
select ceil(null) as r;
|
|
163
|
+
→ [{"r":null}]
|
|
164
|
+
|
|
165
|
+
select ceiling(null) as r;
|
|
166
|
+
→ [{"r":null}]
|
|
167
|
+
|
|
168
|
+
-- clamp's implementation reaches Number() for all three arguments at once, so its null
|
|
169
|
+
-- short-circuit is explicit — Number(null) is 0, which would return the lower bound.
|
|
170
|
+
select clamp(null, 1, 2) as r;
|
|
171
|
+
→ [{"r":null}]
|
|
172
|
+
|
|
173
|
+
select clamp(5, null, 10) as r;
|
|
174
|
+
→ [{"r":null}]
|
|
175
|
+
|
|
176
|
+
select clamp(5, 1, null) as r;
|
|
177
|
+
→ [{"r":null}]
|
|
178
|
+
|
|
179
|
+
-- ===================================
|
|
180
|
+
-- 7. A textual argument is still rejected at plan time
|
|
181
|
+
-- ===================================
|
|
182
|
+
-- Widening the gate to ANY and NULL must not widen it to TEXT.
|
|
183
|
+
select abs('abc') as r;
|
|
184
|
+
-- error: Invalid argument types for function abs
|
|
185
|
+
|
|
186
|
+
select floor('abc') as r;
|
|
187
|
+
-- error: Invalid argument types for function floor
|
|
188
|
+
|
|
189
|
+
select clamp('a', 1, 2) as r;
|
|
190
|
+
-- error: Invalid argument types for function clamp
|
|
191
|
+
|
|
192
|
+
select abs(d) as r from urt;
|
|
193
|
+
-- error: Invalid argument types for function abs
|
|
194
|
+
|
|
195
|
+
-- ===================================
|
|
196
|
+
-- 8. Arithmetic and aggregation over an ANY-typed value
|
|
197
|
+
-- ===================================
|
|
198
|
+
-- These were WRONG under the REAL default, not merely unspecialized: emitArithmeticOp
|
|
199
|
+
-- took its numeric-fast path (`runtime/emit/binary.ts`), which trusts the declared type
|
|
200
|
+
-- and applies the JS operator to the raw value. strftime returns the string '2024', so
|
|
201
|
+
-- `'2024' + 1` concatenated to '20241', failed the Number.isFinite check and came back
|
|
202
|
+
-- NULL. ANY routes to the generic path, which coerces first.
|
|
203
|
+
select strftime('%Y', d) + 1 as r from urt where id = 1;
|
|
204
|
+
→ [{"r":2025}]
|
|
205
|
+
|
|
206
|
+
-- `abs(strftime(...))` was 2024 while strftime rode the ANY default: the numeric
|
|
207
|
+
-- builtins' plan-time gate accepts "numeric OR unclassifiable", and ANY is
|
|
208
|
+
-- unclassifiable. Ticket 2-builtin-scalar-function-declared-return-types declared
|
|
209
|
+
-- strftime's real return type (TEXT), so the argument is now classifiable and the gate
|
|
210
|
+
-- rejects it — the same rejection `abs(d)` gets in section 7, for the same reason.
|
|
211
|
+
-- Write `abs(integer(strftime(...)))` to convert first.
|
|
212
|
+
select abs(strftime('%Y', d)) as r from urt where id = 1;
|
|
213
|
+
-- error: Invalid argument types for function abs
|
|
214
|
+
|
|
215
|
+
select abs(integer(strftime('%Y', d))) as r from urt where id = 1;
|
|
216
|
+
→ [{"r":2024}]
|
|
217
|
+
|
|
218
|
+
-- Aggregates: an ANY-typed argument no longer skips coerceForAggregate
|
|
219
|
+
-- (`computeAggregateSkipCoercion`, runtime/emit/aggregate-setup.ts).
|
|
220
|
+
select sum(strftime('%Y', d)) as s, avg(strftime('%Y', d)) as a from urt;
|
|
221
|
+
→ [{"s":4047,"a":2023.5}]
|
|
222
|
+
|
|
223
|
+
-- ===================================
|
|
224
|
+
-- 9. The deliberate loss: a numeric-looking STRING no longer coerces
|
|
225
|
+
-- ===================================
|
|
226
|
+
-- Not guessing REAL costs exactly this much. `json_extract(...) = '5'` was TRUE (the
|
|
227
|
+
-- planner cast '5' to REAL 5); it is now FALSE, because an ANY operand gives the
|
|
228
|
+
-- numeric↔textual arm of insertCrossTypeCoercion nothing to key on and the runtime
|
|
229
|
+
-- compares an integer against text — different storage classes. Note this is NOT the gap
|
|
230
|
+
-- bug-numeric-text-coercion-skips-in-and-case closed: that one was about the coercion
|
|
231
|
+
-- being skipped at some comparison SITES; here every site applies it and there is simply
|
|
232
|
+
-- no declared numeric type to key on.
|
|
233
|
+
-- Pinned so the next change to the numeric↔text story is a deliberate one. json_extract
|
|
234
|
+
-- is deliberately still ANY (its result shape depends on the data), so the loss is real
|
|
235
|
+
-- here; every builtin that CAN name a type now does, which restores the coercion — see
|
|
236
|
+
-- 06.5.4-declared-return-type-builtins.sqllogic.
|
|
237
|
+
select json_extract('{"n":5}', '$.n') = '5' as r;
|
|
238
|
+
→ [{"r":false}]
|
|
239
|
+
|
|
240
|
+
-- Against an actual number it is true, as it always was.
|
|
241
|
+
select json_extract('{"n":5}', '$.n') = 5 as r;
|
|
242
|
+
→ [{"r":true}]
|
|
243
|
+
|
|
244
|
+
drop table urt;
|