@quereus/quereus 4.20.1 → 4.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +7 -4
- package/test/README.md +173 -0
- package/test/logic/01-basic.sqllogic +39 -0
- package/test/logic/01.1-select-projection-extras.sqllogic +130 -0
- package/test/logic/01.2-strings.sqllogic +43 -0
- package/test/logic/01.5-insert-select.sqllogic +237 -0
- package/test/logic/01.6-update-extras.sqllogic +118 -0
- package/test/logic/01.7-update-from.sqllogic +67 -0
- package/test/logic/01.8-delete-extras.sqllogic +122 -0
- package/test/logic/01.8.1-delete-range-cow.sqllogic +115 -0
- package/test/logic/01.9-query-expr-dml-gates.sqllogic +32 -0
- package/test/logic/01.9-query-expr-dml.sqllogic +171 -0
- package/test/logic/01.9-query-expr-values.sqllogic +111 -0
- package/test/logic/01.9.1-limit-over-dml-subquery.sqllogic +119 -0
- package/test/logic/02-filters.sqllogic +54 -0
- package/test/logic/02-smoke.sqllogic +62 -0
- package/test/logic/02.1-bind-parameters.sqllogic +223 -0
- package/test/logic/03-expressions.sqllogic +190 -0
- package/test/logic/03.1-quoted-identifiers.sqllogic +55 -0
- package/test/logic/03.4-defaults.sqllogic +554 -0
- package/test/logic/03.4.1-default-edge-cases.sqllogic +99 -0
- package/test/logic/03.5-tvf.sqllogic +61 -0
- package/test/logic/03.6-type-system.sqllogic +544 -0
- package/test/logic/03.6.1-numeric-text-comparison-coercion.sqllogic +244 -0
- package/test/logic/03.6.2-value-to-text.sqllogic +224 -0
- package/test/logic/03.7-bigint-mixed-arithmetic.sqllogic +65 -0
- package/test/logic/03.8-not-precedence.sqllogic +255 -0
- package/test/logic/03.9-is-bool-predicate.sqllogic +150 -0
- package/test/logic/03.9.1-is-bool-predicate-partial-index.sqllogic +34 -0
- package/test/logic/04-order-by.sqllogic +38 -0
- package/test/logic/04-transactions.sqllogic +239 -0
- package/test/logic/04a-savepoint-lazy-attach.sqllogic +122 -0
- package/test/logic/05-vtab_memory.sqllogic +50 -0
- package/test/logic/05.0.1-vtab-memory-unique-index-collation.sqllogic +34 -0
- package/test/logic/05.1-composite-pk-range-scan.sqllogic +147 -0
- package/test/logic/05.1.1-secondary-index-range-scan.sqllogic +56 -0
- package/test/logic/05.2-cast-seek-correctness.sqllogic +124 -0
- package/test/logic/06-builtin_functions.sqllogic +149 -0
- package/test/logic/06.1-string-functions.sqllogic +92 -0
- package/test/logic/06.1.3-like-glob-edges.sqllogic +53 -0
- package/test/logic/06.2-math-functions.sqllogic +82 -0
- package/test/logic/06.3-schema.sqllogic +48 -0
- package/test/logic/06.3.1-schema-all-schemas.sqllogic +39 -0
- package/test/logic/06.3.2-schema-foreign-keys.sqllogic +208 -0
- package/test/logic/06.3.3-introspection-tags.sqllogic +202 -0
- package/test/logic/06.3.3.1-introspection-tags-index.sqllogic +74 -0
- package/test/logic/06.3.4-view-info.sqllogic +378 -0
- package/test/logic/06.3.5-column-info.sqllogic +347 -0
- package/test/logic/06.3.6-schema-views.sqllogic +29 -0
- package/test/logic/06.4-schema-search-path.sqllogic +354 -0
- package/test/logic/06.4.1-schema-case-insensitive.sqllogic +83 -0
- package/test/logic/06.4.2-collation-extras.sqllogic +472 -0
- package/test/logic/06.4.2.1-collation-index-access-paths.sqllogic +140 -0
- package/test/logic/06.4.3-write-path-collation.sqllogic +99 -0
- package/test/logic/06.4.4-comparison-collation-precedence.sqllogic +342 -0
- package/test/logic/06.4.5-any-collate-declared-keys.sqllogic +92 -0
- package/test/logic/06.5-polymorphic-types.sqllogic +169 -0
- package/test/logic/06.5.1-conversion-functions.sqllogic +173 -0
- package/test/logic/06.5.2-scalar-minmax.sqllogic +16 -0
- package/test/logic/06.5.3-undeclared-return-type-comparison.sqllogic +244 -0
- package/test/logic/06.5.4-declared-return-type-builtins.sqllogic +288 -0
- package/test/logic/06.6-aggregate-extended.sqllogic +78 -0
- package/test/logic/06.7-json-extended.sqllogic +53 -0
- package/test/logic/06.8-json-path-operators.sqllogic +99 -0
- package/test/logic/06.9-json-canonical-key.sqllogic +65 -0
- package/test/logic/06.9.1-json-coerce-once.sqllogic +417 -0
- package/test/logic/06.9.1.1-json-coerce-once-index.sqllogic +39 -0
- package/test/logic/06.9.2-json-structural-equality.sqllogic +382 -0
- package/test/logic/06.9.2.1-json-structural-equality-index.sqllogic +76 -0
- package/test/logic/06.9.3-json-index-range-seek.sqllogic +205 -0
- package/test/logic/07-aggregates.sqllogic +193 -0
- package/test/logic/07.1-aggregate-filter-clause.sqllogic +12 -0
- package/test/logic/07.2-aggregate-order-by.sqllogic +11 -0
- package/test/logic/07.3-group-by-extras.sqllogic +602 -0
- package/test/logic/07.3.1-group-by-order-by-key.sqllogic +164 -0
- package/test/logic/07.3.2-grouped-select-list-shape.sqllogic +231 -0
- package/test/logic/07.4-group-by-filter-composite-pk.sqllogic +120 -0
- package/test/logic/07.5-sum-mixed-exact-and-float.sqllogic +151 -0
- package/test/logic/07.5-window.sqllogic +1941 -0
- package/test/logic/07.5.1-window-named.sqllogic +13 -0
- package/test/logic/07.5.2-window-nth-value.sqllogic +13 -0
- package/test/logic/07.6-subqueries.sqllogic +78 -0
- package/test/logic/07.6.1-subquery-extras.sqllogic +93 -0
- package/test/logic/07.7-and-or-short-circuit.sqllogic +58 -0
- package/test/logic/07.7-in-subquery-caching.sqllogic +174 -0
- package/test/logic/07.7-scalar-agg-decorrelation.sqllogic +197 -0
- package/test/logic/07.7.1-in-extras.sqllogic +158 -0
- package/test/logic/07.7.1-scalar-agg-decorrelation-filter.sqllogic +105 -0
- package/test/logic/07.7.2-scalar-agg-decorrelation-nested.sqllogic +115 -0
- package/test/logic/07.7.3-exists-in-select-decorrelation.sqllogic +107 -0
- package/test/logic/07.7.4-where-conjunct-ordering.sqllogic +121 -0
- package/test/logic/07.7.5-filter-lost-under-index-order.sqllogic +134 -0
- package/test/logic/07.7.6-correlated-predicate-scope.sqllogic +178 -0
- package/test/logic/07.7.7-join-source-scope-shadowing.sqllogic +137 -0
- package/test/logic/07.7.8-correlated-ref-to-computed-column.sqllogic +165 -0
- package/test/logic/07.7.9-conjunct-monotonicity.sqllogic +200 -0
- package/test/logic/07.8-correlated-subquery-edges.sqllogic +71 -0
- package/test/logic/07.8.1-correlated-in-decorrelation-gates.sqllogic +156 -0
- package/test/logic/07.9-in-value-list.sqllogic +154 -0
- package/test/logic/07.9.1-in-value-list-composite-index.sqllogic +38 -0
- package/test/logic/08-views.sqllogic +64 -0
- package/test/logic/08.1-semi-anti-join.sqllogic +191 -0
- package/test/logic/08.1-view-edge-cases.sqllogic +118 -0
- package/test/logic/08.1.1-uncorrelated-in-semijoin.sqllogic +251 -0
- package/test/logic/08.2-existence-flag-semijoin-recovery.sqllogic +197 -0
- package/test/logic/08.3-existence-flag-inner-recovery.sqllogic +102 -0
- package/test/logic/08.4-key-set-semi-join.sqllogic +447 -0
- package/test/logic/09-set_operations.sqllogic +244 -0
- package/test/logic/09.1-set-op-cross-collation.sqllogic +230 -0
- package/test/logic/10-distinct_datatypes.sqllogic +127 -0
- package/test/logic/10.1-ddl-lifecycle.sqllogic +203 -0
- package/test/logic/10.1.1-create-table-syntax-edges.sqllogic +47 -0
- package/test/logic/10.1.2-ddl-in-transaction.sqllogic +143 -0
- package/test/logic/10.1.2.1-add-constraint-in-transaction.sqllogic +59 -0
- package/test/logic/10.1.3-ddl-drop-in-transaction.sqllogic +187 -0
- package/test/logic/10.1.3.1-drop-constraint-in-transaction.sqllogic +45 -0
- package/test/logic/10.1.4-create-table-duplicate-constraint-names.sqllogic +149 -0
- package/test/logic/10.1.4-ddl-transaction-policy.sqllogic +314 -0
- package/test/logic/10.1.5-alter-add-constraint-minted-name-disambiguation.sqllogic +219 -0
- package/test/logic/10.1.5-create-index-lifecycle.sqllogic +72 -0
- package/test/logic/10.1.6-ddl-transaction-policy-index.sqllogic +143 -0
- package/test/logic/10.1.7-create-table-default-type-check.sqllogic +119 -0
- package/test/logic/10.1.8-alter-add-check-existing-rows.sqllogic +117 -0
- package/test/logic/10.2-column-features.sqllogic +365 -0
- package/test/logic/10.2.1-table-options-rejection.sqllogic +63 -0
- package/test/logic/10.2.2-default-collation-memory.sqllogic +30 -0
- package/test/logic/10.3-function-features.sqllogic +247 -0
- package/test/logic/10.4-schema-scale.sqllogic +168 -0
- package/test/logic/10.4.1-schema-scale-indexes.sqllogic +121 -0
- package/test/logic/10.5-indexes.sqllogic +164 -0
- package/test/logic/10.5.1-partial-indexes.sqllogic +526 -0
- package/test/logic/10.5.2-expression-indexes.sqllogic +34 -0
- package/test/logic/10.5.3-desc-index-ordering.sqllogic +130 -0
- package/test/logic/10.5.4-composite-pk-index-update-phantom.sqllogic +55 -0
- package/test/logic/10.5.5-index-name-uniqueness.sqllogic +76 -0
- package/test/logic/10.5.6-minmax-index-boundary.sqllogic +204 -0
- package/test/logic/10.5.7-implicit-unique-index-lifecycle.sqllogic +1216 -0
- package/test/logic/10.6-distinct-edge-cases.sqllogic +119 -0
- package/test/logic/100-predicate-normalization-edge-cases.sqllogic +238 -0
- package/test/logic/100.1-where-extras.sqllogic +163 -0
- package/test/logic/100.1.1-where-join-on-order-indexed.sqllogic +35 -0
- package/test/logic/101-builtin-mutation-kills.sqllogic +974 -0
- package/test/logic/101-transaction-edge-cases.sqllogic +395 -0
- package/test/logic/102-schema-catalog-edge-cases.sqllogic +252 -0
- package/test/logic/102-unique-constraints.sqllogic +145 -0
- package/test/logic/102.0.1-schema-catalog-indexed-table.sqllogic +32 -0
- package/test/logic/102.1-unique-edge-cases.sqllogic +111 -0
- package/test/logic/102.1.1-unique-index-creation-edge-cases.sqllogic +75 -0
- package/test/logic/102.2-unique-collation.sqllogic +181 -0
- package/test/logic/102.2.1-unique-collation-index-derived.sqllogic +305 -0
- package/test/logic/103-database-options-edge-cases.sqllogic +108 -0
- package/test/logic/103.1-pragma-boolean-values.sqllogic +126 -0
- package/test/logic/104-emit-mutation-kills.sqllogic +236 -0
- package/test/logic/105-vtab-memory-mutation-kills.sqllogic +754 -0
- package/test/logic/105.1-vtab-memory-index-mutation-kills.sqllogic +540 -0
- package/test/logic/106-constraint-extractor-mutation-kills.sqllogic +350 -0
- package/test/logic/107-temporal-arithmetic-mutation-kills.sqllogic +833 -0
- package/test/logic/108-cardinality-estimation.sqllogic +146 -0
- package/test/logic/108.1-analyze-name-resolution.sqllogic +102 -0
- package/test/logic/109-aggregate-physical-selection.sqllogic +103 -0
- package/test/logic/11-joins.sqllogic +86 -0
- package/test/logic/11.1-join-using.sqllogic +267 -0
- package/test/logic/11.2-comma-join.sqllogic +35 -0
- package/test/logic/11.3-index-nested-loop-join.sqllogic +305 -0
- package/test/logic/11.3-mismatched-collation-join.sqllogic +74 -0
- package/test/logic/11.4-hash-join-side-swap.sqllogic +118 -0
- package/test/logic/110-scan-emitter-mutation-kills.sqllogic +121 -0
- package/test/logic/110.1-scan-emitter-index-scan-kills.sqllogic +47 -0
- package/test/logic/12-empty-primary-key.sqllogic +124 -0
- package/test/logic/12-join_padding_order.sqllogic +58 -0
- package/test/logic/12.1-orderby-index-consumption.sqllogic +40 -0
- package/test/logic/13-cte.sqllogic +137 -0
- package/test/logic/13.1-cte-multiple-recursive.sqllogic +104 -0
- package/test/logic/13.10-cte-qualified-name.sqllogic +136 -0
- package/test/logic/13.11-unreferenced-dml-cte.sqllogic +414 -0
- package/test/logic/13.12-nested-dml-cte-rejected.sqllogic +280 -0
- package/test/logic/13.2-cte-bind-params.sqllogic +98 -0
- package/test/logic/13.3-cte-edge-cases.sqllogic +120 -0
- package/test/logic/13.4-cte-extras.sqllogic +98 -0
- package/test/logic/13.5-cte-join-order.sqllogic +166 -0
- package/test/logic/13.6-cte-dml-runs-once.sqllogic +318 -0
- package/test/logic/13.7-cte-sibling-visibility.sqllogic +227 -0
- package/test/logic/13.8-insert-with-clause-visibility.sqllogic +254 -0
- package/test/logic/13.9-schema-authored-cte-isolation.sqllogic +328 -0
- package/test/logic/13.9.1-schema-authored-schema-path-isolation.sqllogic +408 -0
- package/test/logic/14-utilities.sqllogic +168 -0
- package/test/logic/15-timespan.sqllogic +279 -0
- package/test/logic/15.1-semantic-ordering.sqllogic +960 -0
- package/test/logic/15.1.1-json-check-coercion.sqllogic +178 -0
- package/test/logic/15.1.2-semantic-ordering-index.sqllogic +41 -0
- package/test/logic/15.1.3-declared-form-write-contract.sqllogic +519 -0
- package/test/logic/16-epoch.sqllogic +187 -0
- package/test/logic/17-weekday-modifier.sqllogic +78 -0
- package/test/logic/18-json-string-escapes.sqllogic +86 -0
- package/test/logic/18-strftime-extended-formats.sqllogic +68 -0
- package/test/logic/20-empty-single-row.sqllogic +261 -0
- package/test/logic/21-null-edge-cases.sqllogic +227 -0
- package/test/logic/21.1-where-null-comparisons.sqllogic +151 -0
- package/test/logic/21.1.1-where-null-comparisons-secondary-index.sqllogic +35 -0
- package/test/logic/21.2-between-edges.sqllogic +157 -0
- package/test/logic/22-boundary-values.sqllogic +175 -0
- package/test/logic/23-self-joins-duplicates.sqllogic +74 -0
- package/test/logic/24-builtin-branches.sqllogic +611 -0
- package/test/logic/24.1-substr-extras.sqllogic +75 -0
- package/test/logic/24.2-random-extras.sqllogic +39 -0
- package/test/logic/25-aggregate-edge-cases.sqllogic +289 -0
- package/test/logic/25.1-nested-aggregates.sqllogic +74 -0
- package/test/logic/25.2-having-edge-cases.sqllogic +318 -0
- package/test/logic/25.3-aggregate-isnull-empty.sqllogic +16 -0
- package/test/logic/25.4-groupby-fd-constant-empty.sqllogic +55 -0
- package/test/logic/25.5-ungrouped-aggregate-column-free-select-item.sqllogic +196 -0
- package/test/logic/26-join-edge-cases.sqllogic +333 -0
- package/test/logic/26.1-left-join-isnull-on-notnull.sqllogic +26 -0
- package/test/logic/26.2-left-join-on-vs-where.sqllogic +67 -0
- package/test/logic/26.3-join-on-constants.sqllogic +61 -0
- package/test/logic/26.4-join-on-is-null-nullable.sqllogic +44 -0
- package/test/logic/27-window-edge-cases.sqllogic +206 -0
- package/test/logic/27.1-window-groups-frame.sqllogic +13 -0
- package/test/logic/27.2-window-exclude.sqllogic +13 -0
- package/test/logic/27.3-window-json-aggregation.sqllogic +66 -0
- package/test/logic/28-set-ops-sort-edge-cases.sqllogic +444 -0
- package/test/logic/28.1-compound-limit-offset.sqllogic +143 -0
- package/test/logic/28.2-orderby-expression-extras.sqllogic +698 -0
- package/test/logic/28.2-set-op-branch-types.sqllogic +217 -0
- package/test/logic/29-constraint-edge-cases.sqllogic +442 -0
- package/test/logic/29.1-column-level-conflict-clause.sqllogic +171 -0
- package/test/logic/29.2-table-level-pk-conflict-clause.sqllogic +113 -0
- package/test/logic/40-constraints.sqllogic +418 -0
- package/test/logic/40.1-pk-desc-direction.sqllogic +76 -0
- package/test/logic/40.2-check-extras.sqllogic +683 -0
- package/test/logic/41-alter-table.sqllogic +191 -0
- package/test/logic/41-fk-cascade-conflict-and-self-ref.sqllogic +263 -0
- package/test/logic/41-fk-cross-schema.sqllogic +155 -0
- package/test/logic/41-fk-extended-targets.sqllogic +173 -0
- package/test/logic/41-foreign-keys.sqllogic +1001 -0
- package/test/logic/41-generated-column-errors.sqllogic +225 -0
- package/test/logic/41-generated-column-extras.sqllogic +598 -0
- package/test/logic/41-generated-column-scope.sqllogic +329 -0
- package/test/logic/41-generated-columns.sqllogic +361 -0
- package/test/logic/41.1-alter-pk.sqllogic +230 -0
- package/test/logic/41.1-fk-collation-conflict.sqllogic +277 -0
- package/test/logic/41.10-alter-drop-column-foreign-key.sqllogic +274 -0
- package/test/logic/41.10.1-alter-drop-column-unique-index.sqllogic +169 -0
- package/test/logic/41.10.2-alter-drop-column-check-and-assertion.sqllogic +1616 -0
- package/test/logic/41.10.3-alter-drop-column-referencing-fk.sqllogic +292 -0
- package/test/logic/41.10.4-drop-object-expression-dependents.sqllogic +602 -0
- package/test/logic/41.11-deferred-fk-with-rename.sqllogic +232 -0
- package/test/logic/41.12-alter-default-coercion.sqllogic +200 -0
- package/test/logic/41.13-alter-add-column-generated-backfill.sqllogic +566 -0
- package/test/logic/41.14-alter-add-column-subquery-backfill.sqllogic +129 -0
- package/test/logic/41.15-alter-column-default-type-check.sqllogic +178 -0
- package/test/logic/41.16-fk-unenforceable.sqllogic +364 -0
- package/test/logic/41.2-alter-column.sqllogic +382 -0
- package/test/logic/41.2.1-alter-column-retype-deleted-row-memory.sqllogic +32 -0
- package/test/logic/41.2.2-alter-column-retype-index-rebuild.sqllogic +77 -0
- package/test/logic/41.2.3-alter-column-set-not-null-pk-backfill.sqllogic +310 -0
- package/test/logic/41.2.3.1-alter-column-set-not-null-pk-backfill-secondary-index.sqllogic +37 -0
- package/test/logic/41.3-alter-add-column-unique.sqllogic +184 -0
- package/test/logic/41.3-alter-rename-propagation.sqllogic +2352 -0
- package/test/logic/41.3.1-alter-rename-index-propagation.sqllogic +94 -0
- package/test/logic/41.4-alter-add-column-constraints.sqllogic +855 -0
- package/test/logic/41.5-alter-misc.sqllogic +48 -0
- package/test/logic/41.5-cross-schema-foreign-keys.sqllogic +253 -0
- package/test/logic/41.6-alter-drop-rename-constraint.sqllogic +354 -0
- package/test/logic/41.6.1-alter-drop-constraint-index-derived.sqllogic +22 -0
- package/test/logic/41.7-alter-column-collate.sqllogic +105 -0
- package/test/logic/41.7.1-alter-column-collate-unique.sqllogic +45 -0
- package/test/logic/41.7.2-alter-column-collate-unique-store.sqllogic +208 -0
- package/test/logic/41.7.2.1-alter-column-collate-unique-index-store.sqllogic +114 -0
- package/test/logic/41.7.3-alter-column-retype-unique.sqllogic +293 -0
- package/test/logic/41.7.3.1-alter-column-retype-staged-rows-memory.sqllogic +41 -0
- package/test/logic/41.7.3.2-alter-column-retype-unique-index.sqllogic +72 -0
- package/test/logic/41.7.4-alter-column-retype-semantic-memory.sqllogic +445 -0
- package/test/logic/41.7.4.1-alter-column-retype-semantic-index-memory.sqllogic +91 -0
- package/test/logic/41.7.5-alter-column-collate-pk-staged-delete-memory.sqllogic +106 -0
- package/test/logic/41.8-alter-add-constraint-unique-fk.sqllogic +275 -0
- package/test/logic/41.8-alter-savepoint-staged-rows.sqllogic +443 -0
- package/test/logic/41.8.1-alter-rename-savepoint-staged-rows.sqllogic +408 -0
- package/test/logic/41.9-alter-constraint-body-change.sqllogic +180 -0
- package/test/logic/41.9-fk-restrict-batched.sqllogic +290 -0
- package/test/logic/42-committed-snapshot.sqllogic +254 -0
- package/test/logic/42-returning.sqllogic +159 -0
- package/test/logic/42.1-returning-extras.sqllogic +232 -0
- package/test/logic/42.2-returning-stored-row.sqllogic +165 -0
- package/test/logic/43-default-nullability.sqllogic +131 -0
- package/test/logic/43-transition-constraints.sqllogic +341 -0
- package/test/logic/43.1-default-collation.sqllogic +140 -0
- package/test/logic/43.1-notnull-or-conflict.sqllogic +79 -0
- package/test/logic/43.2-deferred-check-new-on-delete.sqllogic +95 -0
- package/test/logic/43.3-nullable-primary-key.sqllogic +587 -0
- package/test/logic/44-determinism-validation.sqllogic +164 -0
- package/test/logic/44-orthogonality.sqllogic +146 -0
- package/test/logic/44.1-nondeterministic-schema.sqllogic +316 -0
- package/test/logic/45-udf-determinism.sqllogic +39 -0
- package/test/logic/46-mutation-context.sqllogic +595 -0
- package/test/logic/47-upsert.sqllogic +255 -0
- package/test/logic/47.1-upsert-conflict-targets.sqllogic +169 -0
- package/test/logic/47.2-replace-and-or-clauses.sqllogic +164 -0
- package/test/logic/47.2.1-pk-replace-secondary-unique.sqllogic +374 -0
- package/test/logic/47.3-engine-or-fail.sqllogic +122 -0
- package/test/logic/47.3-upsert-conflict-target-collation.sqllogic +139 -0
- package/test/logic/47.3.1-upsert-conflict-index-derived-collation.sqllogic +25 -0
- package/test/logic/47.4-upsert-conflict-target-affinity.sqllogic +59 -0
- package/test/logic/47.5-upsert-do-update-constraints.sqllogic +440 -0
- package/test/logic/47.6-upsert-do-update-decomposed.sqllogic +100 -0
- package/test/logic/49-reference-graph.sqllogic +84 -0
- package/test/logic/50-declarative-schema.sqllogic +2550 -0
- package/test/logic/50-metadata-tags.sqllogic +1033 -0
- package/test/logic/50.0.1-metadata-tags-index.sqllogic +141 -0
- package/test/logic/50.1-declare-schema-pk.sqllogic +150 -0
- package/test/logic/50.2-declare-schema-renames.sqllogic +949 -0
- package/test/logic/50.2.1-declare-schema-index-renames.sqllogic +173 -0
- package/test/logic/50.3-declare-schema-duplicate-names.sqllogic +280 -0
- package/test/logic/50.4-declare-schema-apply-restore.sqllogic +192 -0
- package/test/logic/51-lens-foundation.sqllogic +147 -0
- package/test/logic/51-materialized-views.sqllogic +376 -0
- package/test/logic/51.5-materialized-views-coarsened-key.sqllogic +198 -0
- package/test/logic/51.7-maintained-table-attach-detach.sqllogic +468 -0
- package/test/logic/51.8-maintained-table-declared-constraints.sqllogic +440 -0
- package/test/logic/51.85-maintained-table-parent-fk.sqllogic +103 -0
- package/test/logic/51.9-maintained-table-secondary-unique.sqllogic +237 -0
- package/test/logic/51.9.1-maintained-table-partial-unique.sqllogic +36 -0
- package/test/logic/52-lens-overrides.sqllogic +566 -0
- package/test/logic/53-materialized-views-rowtime.sqllogic +1601 -0
- package/test/logic/53-reserved-tags.sqllogic +252 -0
- package/test/logic/53.1-materialized-view-write-through.sqllogic +329 -0
- package/test/logic/53.2-materialized-view-rename-propagation.sqllogic +483 -0
- package/test/logic/53.3-materialized-view-constraint-only-ddl.sqllogic +409 -0
- package/test/logic/53.3.1-materialized-view-index-ddl-irrelevance.sqllogic +29 -0
- package/test/logic/53.4-materialized-view-structural-alter-restore.sqllogic +436 -0
- package/test/logic/54-covering-mv-enforcement.sqllogic +314 -0
- package/test/logic/54.1-covering-mv-partial-enforcement.sqllogic +34 -0
- package/test/logic/55-internal-eviction-reporting.sqllogic +89 -0
- package/test/logic/55-lens-prover.sqllogic +202 -0
- package/test/logic/55.1-eviction-restrict-fk.sqllogic +148 -0
- package/test/logic/55.5-lens-authored-inverse.sqllogic +1468 -0
- package/test/logic/80-grow-retrieve-pass.sqllogic +79 -0
- package/test/logic/81-quickpick.sqllogic +24 -0
- package/test/logic/82-bloom-join.sqllogic +185 -0
- package/test/logic/83-merge-join.sqllogic +280 -0
- package/test/logic/84-asof-scan.sqllogic +238 -0
- package/test/logic/84-key-cardinality.sqllogic +50 -0
- package/test/logic/85-relational-const-folding.sqllogic +51 -0
- package/test/logic/86-scalar-cse.sqllogic +42 -0
- package/test/logic/90-error_paths.sqllogic +114 -0
- package/test/logic/90.1-parse-errors.sqllogic +77 -0
- package/test/logic/90.2-alter-table-errors.sqllogic +53 -0
- package/test/logic/90.2.1-alter-extra-errors.sqllogic +51 -0
- package/test/logic/90.3-expression-errors.sqllogic +43 -0
- package/test/logic/90.4-dml-errors.sqllogic +47 -0
- package/test/logic/90.5-unsupported-join-types.sqllogic +37 -0
- package/test/logic/90.5.1-right-full-join-read.sqllogic +157 -0
- package/test/logic/90.6-select-error-paths.sqllogic +57 -0
- package/test/logic/91-merge-join-edge-cases.sqllogic +159 -0
- package/test/logic/92-hash-aggregate-edge-cases.sqllogic +139 -0
- package/test/logic/93-ddl-view-edge-cases.sqllogic +104 -0
- package/test/logic/93.1-view-error-paths.sqllogic +74 -0
- package/test/logic/93.2-view-mutation-pending.sqllogic +108 -0
- package/test/logic/93.3-view-mutation-or-clause.sqllogic +60 -0
- package/test/logic/93.4-view-mutation.sqllogic +4881 -0
- package/test/logic/93.4.1-view-mutation-partial-unique-cardinality.sqllogic +31 -0
- package/test/logic/93.5-authored-inverse.sqllogic +415 -0
- package/test/logic/93.6-set-op-flagless-write.sqllogic +862 -0
- package/test/logic/94-tvf-edge-cases.sqllogic +58 -0
- package/test/logic/94.1-limit-offset-edge-cases.sqllogic +109 -0
- package/test/logic/94.2-limit-offset-extras.sqllogic +98 -0
- package/test/logic/95-assertions.sqllogic +1417 -0
- package/test/logic/96-subquery-edge-cases.sqllogic +276 -0
- package/test/logic/97-json-function-edge-cases.sqllogic +633 -0
- package/test/logic/97.1-json-blob-and-special-values.sqllogic +92 -0
- package/test/logic/98-temporal-edge-cases.sqllogic +515 -0
- package/test/logic/99-conversion-edge-cases.sqllogic +325 -0
- package/test/logic/99.0.1-schema-index-listing.sqllogic +21 -0
- package/test/logic/99.1-cast-syntax-extras.sqllogic +167 -0
- package/test/logic/drop-unique-index.sqllogic +88 -0
- package/test/logic/pushdown-test.sqllogic +36 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
-- 97.1-json-blob-and-special-values.sqllogic
|
|
2
|
+
-- adapted from SQLite test/json101.test, json103.test
|
|
3
|
+
-- BLOB and IEEE non-finite values in JSON construction. SQLite raises
|
|
4
|
+
-- "JSON cannot hold BLOB values"; Quereus's prepareJsonValue silently
|
|
5
|
+
-- converts BLOB and Infinity/NaN to JSON null. NaN/Infinity literals
|
|
6
|
+
-- are not in the parser's grammar, so we use 1.0/0.0 to produce them
|
|
7
|
+
-- via runtime arithmetic where useful.
|
|
8
|
+
|
|
9
|
+
-- ============================================================
|
|
10
|
+
-- json_array: BLOB argument is converted to JSON null
|
|
11
|
+
-- ============================================================
|
|
12
|
+
|
|
13
|
+
SELECT json_array(1, x'414243', 3);
|
|
14
|
+
→ [[1,null,3]]
|
|
15
|
+
|
|
16
|
+
-- BLOB only
|
|
17
|
+
SELECT json_array(x'00');
|
|
18
|
+
→ [[null]]
|
|
19
|
+
|
|
20
|
+
-- ============================================================
|
|
21
|
+
-- json_object: BLOB value is converted to JSON null
|
|
22
|
+
-- ============================================================
|
|
23
|
+
|
|
24
|
+
SELECT json_object('k', x'cafebabe');
|
|
25
|
+
→ [{"k":null}]
|
|
26
|
+
|
|
27
|
+
-- Mixed: some BLOB, some scalar values
|
|
28
|
+
SELECT json_object('a', 1, 'b', x'00', 'c', 'three');
|
|
29
|
+
→ [{"a":1,"b":null,"c":"three"}]
|
|
30
|
+
|
|
31
|
+
-- ============================================================
|
|
32
|
+
-- json_array / json_object: bigint (out of safe-integer range) preserved as string
|
|
33
|
+
-- ============================================================
|
|
34
|
+
|
|
35
|
+
-- bigint within safe range becomes a number
|
|
36
|
+
SELECT json_array(123);
|
|
37
|
+
→ [[123]]
|
|
38
|
+
|
|
39
|
+
-- ============================================================
|
|
40
|
+
-- json_group_array: BLOB rows become JSON null entries
|
|
41
|
+
-- ============================================================
|
|
42
|
+
|
|
43
|
+
CREATE TABLE jagg_blob (id INTEGER PRIMARY KEY, v BLOB NULL);
|
|
44
|
+
INSERT INTO jagg_blob VALUES
|
|
45
|
+
(1, x'01'),
|
|
46
|
+
(2, x'0203'),
|
|
47
|
+
(3, null);
|
|
48
|
+
-- run
|
|
49
|
+
|
|
50
|
+
SELECT json_group_array(v) FROM jagg_blob;
|
|
51
|
+
→ [{"json_group_array(v)":[null,null,null]}]
|
|
52
|
+
|
|
53
|
+
-- ============================================================
|
|
54
|
+
-- json_group_object: BLOB values become JSON null
|
|
55
|
+
-- ============================================================
|
|
56
|
+
|
|
57
|
+
CREATE TABLE jagg_kv (k TEXT PRIMARY KEY, v BLOB NULL);
|
|
58
|
+
INSERT INTO jagg_kv VALUES
|
|
59
|
+
('a', x'01'),
|
|
60
|
+
('b', null),
|
|
61
|
+
('c', x'02');
|
|
62
|
+
-- run
|
|
63
|
+
|
|
64
|
+
SELECT json_group_object(k, v) FROM jagg_kv;
|
|
65
|
+
→ [{"json_group_object(k, v)":{"a":null,"b":null,"c":null}}]
|
|
66
|
+
|
|
67
|
+
-- ============================================================
|
|
68
|
+
-- IEEE non-finite values produced by arithmetic
|
|
69
|
+
-- ============================================================
|
|
70
|
+
|
|
71
|
+
-- 1.0 / 0.0 yields Infinity in JS arithmetic; prepareJsonValue maps to null
|
|
72
|
+
SELECT json_array(1.0 / 0.0);
|
|
73
|
+
→ [[null]]
|
|
74
|
+
|
|
75
|
+
-- 0.0 / 0.0 yields NaN; prepareJsonValue maps to null
|
|
76
|
+
SELECT json_array(0.0 / 0.0);
|
|
77
|
+
→ [[null]]
|
|
78
|
+
|
|
79
|
+
-- ============================================================
|
|
80
|
+
-- json_object: non-string key returns NULL (whole call)
|
|
81
|
+
-- ============================================================
|
|
82
|
+
|
|
83
|
+
-- Numeric key rejected
|
|
84
|
+
SELECT json_object(42, 'value');
|
|
85
|
+
→ [null]
|
|
86
|
+
|
|
87
|
+
-- BLOB-typed key rejected (not a string)
|
|
88
|
+
SELECT json_object(x'00', 'value');
|
|
89
|
+
→ [null]
|
|
90
|
+
|
|
91
|
+
DROP TABLE jagg_blob;
|
|
92
|
+
DROP TABLE jagg_kv;
|
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
-- 98-temporal-edge-cases.sqllogic
|
|
2
|
+
-- Targeted coverage for uncovered branches in temporal-types.ts and timespan.ts:
|
|
3
|
+
-- DATE/TIME/DATETIME parse from numbers, validation edge cases,
|
|
4
|
+
-- TIMESPAN parsing, extraction, totals, human-readable durations,
|
|
5
|
+
-- timezone handling, Temporal.Duration edge cases
|
|
6
|
+
|
|
7
|
+
-- ============================================================
|
|
8
|
+
-- DATE type: parse edge cases
|
|
9
|
+
-- ============================================================
|
|
10
|
+
|
|
11
|
+
-- Valid ISO date
|
|
12
|
+
SELECT date('2024-03-15') as result;
|
|
13
|
+
→ [{"result":"2024-03-15"}]
|
|
14
|
+
|
|
15
|
+
-- Leap year date
|
|
16
|
+
SELECT date('2024-02-29') as result;
|
|
17
|
+
→ [{"result":"2024-02-29"}]
|
|
18
|
+
|
|
19
|
+
-- Non-leap year Feb 29 fails
|
|
20
|
+
SELECT date('2023-02-29');
|
|
21
|
+
-- error: Cannot convert to DATE
|
|
22
|
+
|
|
23
|
+
-- Year boundary
|
|
24
|
+
SELECT date('2024-12-31') as result;
|
|
25
|
+
→ [{"result":"2024-12-31"}]
|
|
26
|
+
|
|
27
|
+
SELECT date('2024-01-01') as result;
|
|
28
|
+
→ [{"result":"2024-01-01"}]
|
|
29
|
+
|
|
30
|
+
-- 'now' special case returns a date (pattern check)
|
|
31
|
+
-- We just verify it doesn't error and returns a string
|
|
32
|
+
SELECT typeof(date('now')) as result;
|
|
33
|
+
→ [{"result":"text"}]
|
|
34
|
+
|
|
35
|
+
-- Null returns null
|
|
36
|
+
SELECT date(null) as result;
|
|
37
|
+
→ [{"result":null}]
|
|
38
|
+
|
|
39
|
+
-- Invalid string
|
|
40
|
+
SELECT date('not-a-date');
|
|
41
|
+
-- error: Cannot convert to DATE
|
|
42
|
+
|
|
43
|
+
-- Empty string
|
|
44
|
+
SELECT date('');
|
|
45
|
+
-- error: Cannot convert to DATE
|
|
46
|
+
|
|
47
|
+
-- ============================================================
|
|
48
|
+
-- TIME type: parse edge cases
|
|
49
|
+
-- ============================================================
|
|
50
|
+
|
|
51
|
+
-- Valid ISO time
|
|
52
|
+
SELECT time('14:30:00') as result;
|
|
53
|
+
→ [{"result":"14:30:00"}]
|
|
54
|
+
|
|
55
|
+
-- Midnight
|
|
56
|
+
SELECT time('00:00:00') as result;
|
|
57
|
+
→ [{"result":"00:00:00"}]
|
|
58
|
+
|
|
59
|
+
-- Time with milliseconds
|
|
60
|
+
SELECT time('12:30:45.123') as result;
|
|
61
|
+
→ [{"result":"12:30:45.123"}]
|
|
62
|
+
|
|
63
|
+
-- 'now' special case
|
|
64
|
+
SELECT typeof(time('now')) as result;
|
|
65
|
+
→ [{"result":"text"}]
|
|
66
|
+
|
|
67
|
+
-- Null
|
|
68
|
+
SELECT time(null) as result;
|
|
69
|
+
→ [{"result":null}]
|
|
70
|
+
|
|
71
|
+
-- Invalid string
|
|
72
|
+
SELECT time('not-a-time');
|
|
73
|
+
-- error: Cannot convert to TIME
|
|
74
|
+
|
|
75
|
+
-- Empty string
|
|
76
|
+
SELECT time('');
|
|
77
|
+
-- error: Cannot convert to TIME
|
|
78
|
+
|
|
79
|
+
-- ============================================================
|
|
80
|
+
-- DATETIME type: parse edge cases
|
|
81
|
+
-- ============================================================
|
|
82
|
+
|
|
83
|
+
-- Valid ISO datetime
|
|
84
|
+
SELECT datetime('2024-03-15T14:30:00') as result;
|
|
85
|
+
→ [{"result":"2024-03-15T14:30:00"}]
|
|
86
|
+
|
|
87
|
+
-- Datetime with milliseconds
|
|
88
|
+
SELECT datetime('2024-01-01T12:00:00.500') as result;
|
|
89
|
+
→ [{"result":"2024-01-01T12:00:00.5"}]
|
|
90
|
+
|
|
91
|
+
-- 'now' special case returns ISO string
|
|
92
|
+
SELECT typeof(datetime('now')) as result;
|
|
93
|
+
→ [{"result":"text"}]
|
|
94
|
+
|
|
95
|
+
-- Null
|
|
96
|
+
SELECT datetime(null) as result;
|
|
97
|
+
→ [{"result":null}]
|
|
98
|
+
|
|
99
|
+
-- Invalid string
|
|
100
|
+
SELECT datetime('not-a-datetime');
|
|
101
|
+
-- error: Cannot convert to DATETIME
|
|
102
|
+
|
|
103
|
+
-- Empty string
|
|
104
|
+
SELECT datetime('');
|
|
105
|
+
-- error: Cannot convert to DATETIME
|
|
106
|
+
|
|
107
|
+
-- ============================================================
|
|
108
|
+
-- TIMESPAN type: ISO 8601 duration parsing
|
|
109
|
+
-- ============================================================
|
|
110
|
+
|
|
111
|
+
-- Basic durations
|
|
112
|
+
SELECT timespan('PT1H') as result;
|
|
113
|
+
→ [{"result":"PT1H"}]
|
|
114
|
+
|
|
115
|
+
SELECT timespan('PT30M') as result;
|
|
116
|
+
→ [{"result":"PT30M"}]
|
|
117
|
+
|
|
118
|
+
SELECT timespan('PT45S') as result;
|
|
119
|
+
→ [{"result":"PT45S"}]
|
|
120
|
+
|
|
121
|
+
SELECT timespan('P1D') as result;
|
|
122
|
+
→ [{"result":"P1D"}]
|
|
123
|
+
|
|
124
|
+
SELECT timespan('P1Y') as result;
|
|
125
|
+
→ [{"result":"P1Y"}]
|
|
126
|
+
|
|
127
|
+
SELECT timespan('P2M') as result;
|
|
128
|
+
→ [{"result":"P2M"}]
|
|
129
|
+
|
|
130
|
+
SELECT timespan('P1W') as result;
|
|
131
|
+
→ [{"result":"P1W"}]
|
|
132
|
+
|
|
133
|
+
-- Combined duration
|
|
134
|
+
SELECT timespan('P1Y2M3DT4H5M6S') as result;
|
|
135
|
+
→ [{"result":"P1Y2M3DT4H5M6S"}]
|
|
136
|
+
|
|
137
|
+
-- Numeric input (seconds)
|
|
138
|
+
SELECT timespan(3600) as result;
|
|
139
|
+
→ [{"result":"PT3600S"}]
|
|
140
|
+
|
|
141
|
+
SELECT timespan(0) as result;
|
|
142
|
+
→ [{"result":"PT0S"}]
|
|
143
|
+
|
|
144
|
+
-- Human-readable durations
|
|
145
|
+
SELECT timespan('1 hour') as result;
|
|
146
|
+
→ [{"result":"PT1H"}]
|
|
147
|
+
|
|
148
|
+
SELECT timespan('30 minutes') as result;
|
|
149
|
+
→ [{"result":"PT30M"}]
|
|
150
|
+
|
|
151
|
+
SELECT timespan('2 days 3 hours') as result;
|
|
152
|
+
→ [{"result":"P2DT3H"}]
|
|
153
|
+
|
|
154
|
+
SELECT timespan('1 year 6 months') as result;
|
|
155
|
+
→ [{"result":"P1Y6M"}]
|
|
156
|
+
|
|
157
|
+
-- Human-readable with abbreviations
|
|
158
|
+
SELECT timespan('5 mins') as result;
|
|
159
|
+
→ [{"result":"PT5M"}]
|
|
160
|
+
|
|
161
|
+
SELECT timespan('10 secs') as result;
|
|
162
|
+
→ [{"result":"PT10S"}]
|
|
163
|
+
|
|
164
|
+
-- Negative human-readable duration
|
|
165
|
+
SELECT timespan('-2 hours') as result;
|
|
166
|
+
→ [{"result":"-PT2H"}]
|
|
167
|
+
|
|
168
|
+
-- Null
|
|
169
|
+
SELECT timespan(null) as result;
|
|
170
|
+
→ [{"result":null}]
|
|
171
|
+
|
|
172
|
+
-- Invalid string
|
|
173
|
+
SELECT timespan('not-a-duration');
|
|
174
|
+
-- error: Cannot convert to TIMESPAN
|
|
175
|
+
|
|
176
|
+
-- ============================================================
|
|
177
|
+
-- TIMESPAN extraction functions
|
|
178
|
+
-- ============================================================
|
|
179
|
+
|
|
180
|
+
-- Years component
|
|
181
|
+
SELECT timespan_years('P2Y3M') as result;
|
|
182
|
+
→ [{"result":2}]
|
|
183
|
+
|
|
184
|
+
-- Months component
|
|
185
|
+
SELECT timespan_months('P2Y3M') as result;
|
|
186
|
+
→ [{"result":3}]
|
|
187
|
+
|
|
188
|
+
-- Weeks component
|
|
189
|
+
SELECT timespan_weeks('P2W') as result;
|
|
190
|
+
→ [{"result":2}]
|
|
191
|
+
|
|
192
|
+
-- Days component
|
|
193
|
+
SELECT timespan_days('P5DT3H') as result;
|
|
194
|
+
→ [{"result":5}]
|
|
195
|
+
|
|
196
|
+
-- Hours component
|
|
197
|
+
SELECT timespan_hours('PT10H30M') as result;
|
|
198
|
+
→ [{"result":10}]
|
|
199
|
+
|
|
200
|
+
-- Minutes component
|
|
201
|
+
SELECT timespan_minutes('PT10H30M') as result;
|
|
202
|
+
→ [{"result":30}]
|
|
203
|
+
|
|
204
|
+
-- Seconds component (simple)
|
|
205
|
+
SELECT timespan_seconds('PT45S') as result;
|
|
206
|
+
→ [{"result":45}]
|
|
207
|
+
|
|
208
|
+
-- Seconds component with fractional parts (milliseconds)
|
|
209
|
+
SELECT timespan_seconds('PT1.5S') as result;
|
|
210
|
+
→ [{"result":1.5}]
|
|
211
|
+
|
|
212
|
+
-- Zero duration components
|
|
213
|
+
SELECT timespan_years('PT1H') as result;
|
|
214
|
+
→ [{"result":0}]
|
|
215
|
+
|
|
216
|
+
SELECT timespan_months('PT1H') as result;
|
|
217
|
+
→ [{"result":0}]
|
|
218
|
+
|
|
219
|
+
SELECT timespan_days('PT1H') as result;
|
|
220
|
+
→ [{"result":0}]
|
|
221
|
+
|
|
222
|
+
-- Null input returns null for all extraction functions
|
|
223
|
+
SELECT timespan_years(null) as result;
|
|
224
|
+
→ [{"result":null}]
|
|
225
|
+
|
|
226
|
+
SELECT timespan_months(null) as result;
|
|
227
|
+
→ [{"result":null}]
|
|
228
|
+
|
|
229
|
+
SELECT timespan_weeks(null) as result;
|
|
230
|
+
→ [{"result":null}]
|
|
231
|
+
|
|
232
|
+
SELECT timespan_days(null) as result;
|
|
233
|
+
→ [{"result":null}]
|
|
234
|
+
|
|
235
|
+
SELECT timespan_hours(null) as result;
|
|
236
|
+
→ [{"result":null}]
|
|
237
|
+
|
|
238
|
+
SELECT timespan_minutes(null) as result;
|
|
239
|
+
→ [{"result":null}]
|
|
240
|
+
|
|
241
|
+
SELECT timespan_seconds(null) as result;
|
|
242
|
+
→ [{"result":null}]
|
|
243
|
+
|
|
244
|
+
-- Invalid input returns null
|
|
245
|
+
SELECT timespan_years('not-a-duration') as result;
|
|
246
|
+
→ [{"result":null}]
|
|
247
|
+
|
|
248
|
+
SELECT timespan_hours('not-a-duration') as result;
|
|
249
|
+
→ [{"result":null}]
|
|
250
|
+
|
|
251
|
+
SELECT timespan_seconds('not-a-duration') as result;
|
|
252
|
+
→ [{"result":null}]
|
|
253
|
+
|
|
254
|
+
-- Non-string input returns null
|
|
255
|
+
SELECT timespan_years(42) as result;
|
|
256
|
+
→ [{"result":null}]
|
|
257
|
+
|
|
258
|
+
SELECT timespan_hours(true) as result;
|
|
259
|
+
→ [{"result":null}]
|
|
260
|
+
|
|
261
|
+
-- ============================================================
|
|
262
|
+
-- TIMESPAN total functions
|
|
263
|
+
-- ============================================================
|
|
264
|
+
|
|
265
|
+
-- Total seconds for time-only duration
|
|
266
|
+
SELECT timespan_total_seconds('PT1H30M') as result;
|
|
267
|
+
→ [{"result":5400}]
|
|
268
|
+
|
|
269
|
+
SELECT timespan_total_seconds('PT1S') as result;
|
|
270
|
+
→ [{"result":1}]
|
|
271
|
+
|
|
272
|
+
-- Total minutes
|
|
273
|
+
SELECT timespan_total_minutes('PT2H30M') as result;
|
|
274
|
+
→ [{"result":150}]
|
|
275
|
+
|
|
276
|
+
-- Total hours
|
|
277
|
+
SELECT timespan_total_hours('P1DT12H') as result;
|
|
278
|
+
→ [{"result":36}]
|
|
279
|
+
|
|
280
|
+
-- Total days
|
|
281
|
+
SELECT timespan_total_days('P1W') as result;
|
|
282
|
+
→ [{"result":7}]
|
|
283
|
+
|
|
284
|
+
-- Total seconds with calendar units (uses reference date)
|
|
285
|
+
SELECT timespan_total_seconds('P1D') as result;
|
|
286
|
+
→ [{"result":86400}]
|
|
287
|
+
|
|
288
|
+
-- Total with null
|
|
289
|
+
SELECT timespan_total_seconds(null) as result;
|
|
290
|
+
→ [{"result":null}]
|
|
291
|
+
|
|
292
|
+
SELECT timespan_total_minutes(null) as result;
|
|
293
|
+
→ [{"result":null}]
|
|
294
|
+
|
|
295
|
+
SELECT timespan_total_hours(null) as result;
|
|
296
|
+
→ [{"result":null}]
|
|
297
|
+
|
|
298
|
+
SELECT timespan_total_days(null) as result;
|
|
299
|
+
→ [{"result":null}]
|
|
300
|
+
|
|
301
|
+
-- Invalid input
|
|
302
|
+
SELECT timespan_total_seconds('not-valid') as result;
|
|
303
|
+
→ [{"result":null}]
|
|
304
|
+
|
|
305
|
+
SELECT timespan_total_minutes('not-valid') as result;
|
|
306
|
+
→ [{"result":null}]
|
|
307
|
+
|
|
308
|
+
SELECT timespan_total_hours('not-valid') as result;
|
|
309
|
+
→ [{"result":null}]
|
|
310
|
+
|
|
311
|
+
SELECT timespan_total_days('not-valid') as result;
|
|
312
|
+
→ [{"result":null}]
|
|
313
|
+
|
|
314
|
+
-- ============================================================
|
|
315
|
+
-- TIMESPAN: arithmetic with temporal values
|
|
316
|
+
-- ============================================================
|
|
317
|
+
|
|
318
|
+
-- Date + timespan
|
|
319
|
+
SELECT date('2024-01-15') + timespan('P10D') as result;
|
|
320
|
+
→ [{"result":"2024-01-25"}]
|
|
321
|
+
|
|
322
|
+
-- Date + month timespan (cross year boundary)
|
|
323
|
+
SELECT date('2024-11-15') + timespan('P3M') as result;
|
|
324
|
+
→ [{"result":"2025-02-15"}]
|
|
325
|
+
|
|
326
|
+
-- ============================================================
|
|
327
|
+
-- TIMESPAN: storage and retrieval
|
|
328
|
+
-- ============================================================
|
|
329
|
+
|
|
330
|
+
CREATE TABLE ts_cmp (id INTEGER PRIMARY KEY, dur TIMESPAN);
|
|
331
|
+
INSERT INTO ts_cmp VALUES (1, 'PT1H'), (2, 'PT30M'), (3, 'P1D'), (4, 'PT2H');
|
|
332
|
+
-- run
|
|
333
|
+
|
|
334
|
+
-- Verify TIMESPAN values are stored and retrieved correctly
|
|
335
|
+
SELECT dur FROM ts_cmp WHERE id = 1;
|
|
336
|
+
→ [{"dur":"PT1H"}]
|
|
337
|
+
|
|
338
|
+
SELECT dur FROM ts_cmp WHERE id = 3;
|
|
339
|
+
→ [{"dur":"P1D"}]
|
|
340
|
+
|
|
341
|
+
-- Comparison in WHERE
|
|
342
|
+
SELECT dur FROM ts_cmp WHERE dur = 'PT1H';
|
|
343
|
+
→ [{"dur":"PT1H"}]
|
|
344
|
+
|
|
345
|
+
DROP TABLE ts_cmp;
|
|
346
|
+
|
|
347
|
+
-- ============================================================
|
|
348
|
+
-- TIMESPAN validation
|
|
349
|
+
-- ============================================================
|
|
350
|
+
|
|
351
|
+
CREATE TABLE ts_val (id INTEGER PRIMARY KEY, dur TIMESPAN NULL);
|
|
352
|
+
INSERT INTO ts_val VALUES (1, 'PT1H');
|
|
353
|
+
INSERT INTO ts_val VALUES (2, null);
|
|
354
|
+
-- run
|
|
355
|
+
|
|
356
|
+
SELECT dur FROM ts_val ORDER BY id;
|
|
357
|
+
→ [{"dur":"PT1H"},{"dur":null}]
|
|
358
|
+
|
|
359
|
+
DROP TABLE ts_val;
|
|
360
|
+
|
|
361
|
+
-- ============================================================
|
|
362
|
+
-- DATETIME: cross-representation canonicalization
|
|
363
|
+
-- All six shapes for the same instant must store identical canonical text.
|
|
364
|
+
-- 1500000000000 ms = 2017-07-14T02:40:00Z = 04:40 in +02:00 = bare 02:40:00 in UTC.
|
|
365
|
+
-- ============================================================
|
|
366
|
+
|
|
367
|
+
CREATE TABLE dt_canon (id INTEGER PRIMARY KEY, ts DATETIME);
|
|
368
|
+
INSERT INTO dt_canon VALUES (1, 1500000000000);
|
|
369
|
+
INSERT INTO dt_canon VALUES (2, '2017-07-14T02:40:00');
|
|
370
|
+
INSERT INTO dt_canon VALUES (3, '2017-07-14T02:40:00Z');
|
|
371
|
+
INSERT INTO dt_canon VALUES (4, '2017-07-14T02:40:00+00:00');
|
|
372
|
+
INSERT INTO dt_canon VALUES (5, '2017-07-14T02:40:00+00:00[UTC]');
|
|
373
|
+
INSERT INTO dt_canon VALUES (6, '2017-07-14T04:40:00+02:00');
|
|
374
|
+
-- run
|
|
375
|
+
|
|
376
|
+
-- All six rows must canonicalize to the same bare PlainDateTime string.
|
|
377
|
+
SELECT count(distinct ts) as c FROM dt_canon;
|
|
378
|
+
→ [{"c":1}]
|
|
379
|
+
|
|
380
|
+
-- And they all equal the canonical form.
|
|
381
|
+
SELECT count(*) as c FROM dt_canon WHERE ts = '2017-07-14T02:40:00';
|
|
382
|
+
→ [{"c":6}]
|
|
383
|
+
|
|
384
|
+
DROP TABLE dt_canon;
|
|
385
|
+
|
|
386
|
+
-- ============================================================
|
|
387
|
+
-- DATE: Z-suffix, offset, zoned, and numeric inputs all → canonical date
|
|
388
|
+
-- ============================================================
|
|
389
|
+
|
|
390
|
+
CREATE TABLE d_canon (id INTEGER PRIMARY KEY, d DATE);
|
|
391
|
+
-- 1705320600000 ms = 2024-01-15T13:30:00Z → date = 2024-01-15
|
|
392
|
+
INSERT INTO d_canon VALUES (1, '2024-01-15');
|
|
393
|
+
INSERT INTO d_canon VALUES (2, '2024-01-15T10:30:00Z');
|
|
394
|
+
INSERT INTO d_canon VALUES (3, '2024-01-15T10:30:00+00:00');
|
|
395
|
+
INSERT INTO d_canon VALUES (4, '2024-01-15T10:30:00+00:00[UTC]');
|
|
396
|
+
INSERT INTO d_canon VALUES (5, 1705320600000);
|
|
397
|
+
-- run
|
|
398
|
+
|
|
399
|
+
SELECT count(distinct d) as c FROM d_canon;
|
|
400
|
+
→ [{"c":1}]
|
|
401
|
+
|
|
402
|
+
SELECT count(*) as c FROM d_canon WHERE d = '2024-01-15';
|
|
403
|
+
→ [{"c":5}]
|
|
404
|
+
|
|
405
|
+
DROP TABLE d_canon;
|
|
406
|
+
|
|
407
|
+
-- ============================================================
|
|
408
|
+
-- TIME: Z-suffix / ISO datetime inputs degrade to canonical UTC time
|
|
409
|
+
-- ============================================================
|
|
410
|
+
|
|
411
|
+
CREATE TABLE t_canon (id INTEGER PRIMARY KEY, t TIME);
|
|
412
|
+
INSERT INTO t_canon VALUES (1, '10:30:00');
|
|
413
|
+
INSERT INTO t_canon VALUES (2, '2024-01-15T10:30:00Z');
|
|
414
|
+
INSERT INTO t_canon VALUES (3, '2024-01-15T10:30:00+00:00');
|
|
415
|
+
INSERT INTO t_canon VALUES (4, '2024-01-15T10:30:00+00:00[UTC]');
|
|
416
|
+
-- run
|
|
417
|
+
|
|
418
|
+
SELECT count(distinct t) as c FROM t_canon;
|
|
419
|
+
→ [{"c":1}]
|
|
420
|
+
|
|
421
|
+
SELECT count(*) as c FROM t_canon WHERE t = '10:30:00';
|
|
422
|
+
→ [{"c":4}]
|
|
423
|
+
|
|
424
|
+
DROP TABLE t_canon;
|
|
425
|
+
|
|
426
|
+
-- ============================================================
|
|
427
|
+
-- DATE / TIME: non-zero offset must shift to UTC, not be silently
|
|
428
|
+
-- stripped as wall-clock. Without canonicalization-first these would
|
|
429
|
+
-- return the local wall-clock date/time instead of the UTC equivalent.
|
|
430
|
+
-- '2024-01-15T01:30:00+02:00' = '2024-01-14T23:30:00Z' (date crosses)
|
|
431
|
+
-- '2024-01-15T10:30:00+02:00' = '2024-01-15T08:30:00Z' (time shifts)
|
|
432
|
+
-- '2024-01-15T23:30:00-05:00' = '2024-01-16T04:30:00Z' (date crosses)
|
|
433
|
+
-- ============================================================
|
|
434
|
+
|
|
435
|
+
CREATE TABLE dt_offset (id INTEGER PRIMARY KEY, d DATE, t TIME);
|
|
436
|
+
INSERT INTO dt_offset VALUES (1, '2024-01-15T01:30:00+02:00', '2024-01-15T01:30:00+02:00');
|
|
437
|
+
INSERT INTO dt_offset VALUES (2, '2024-01-15T10:30:00+02:00', '2024-01-15T10:30:00+02:00');
|
|
438
|
+
INSERT INTO dt_offset VALUES (3, '2024-01-15T23:30:00-05:00', '2024-01-15T23:30:00-05:00');
|
|
439
|
+
-- run
|
|
440
|
+
|
|
441
|
+
SELECT id, d, t FROM dt_offset ORDER BY id;
|
|
442
|
+
→ [{"id":1,"d":"2024-01-14","t":"23:30:00"},{"id":2,"d":"2024-01-15","t":"08:30:00"},{"id":3,"d":"2024-01-16","t":"04:30:00"}]
|
|
443
|
+
|
|
444
|
+
DROP TABLE dt_offset;
|
|
445
|
+
|
|
446
|
+
-- ============================================================
|
|
447
|
+
-- DATETIME pushed-down filter: the comparison LITERAL is compared
|
|
448
|
+
-- RAW (BINARY, no canonicalization) against the stored canonical
|
|
449
|
+
-- value. Row 1 stores the bare form '2017-07-14T02:40:00' (see
|
|
450
|
+
-- dt_canon above). A Z-suffixed or offset-bearing literal that
|
|
451
|
+
-- denotes the SAME instant does NOT match the bare stored value.
|
|
452
|
+
-- Pins the no-canonicalization contract against a future planner
|
|
453
|
+
-- change that inserts a temporal cast or canonicalizes the seek key.
|
|
454
|
+
-- ============================================================
|
|
455
|
+
|
|
456
|
+
CREATE TABLE dt_filter (ts DATETIME PRIMARY KEY);
|
|
457
|
+
INSERT INTO dt_filter VALUES ('2017-07-14T02:40:00Z'); -- stores bare '2017-07-14T02:40:00'
|
|
458
|
+
INSERT INTO dt_filter VALUES ('2017-07-14T03:40:00'); -- a later canonical row, stored bare
|
|
459
|
+
-- run
|
|
460
|
+
|
|
461
|
+
-- Z-suffixed literal of the SAME instant as row 1: raw compare → no match.
|
|
462
|
+
SELECT count(*) as c FROM dt_filter WHERE ts = '2017-07-14T02:40:00Z';
|
|
463
|
+
→ [{"c":0}]
|
|
464
|
+
|
|
465
|
+
-- +01:00-offset literal denoting the SAME instant as row 1
|
|
466
|
+
-- ('2017-07-14T03:40:00+01:00' == 02:40:00Z): still raw, still no match — and
|
|
467
|
+
-- note it does NOT match row 2 either, whose bare stored value shares the
|
|
468
|
+
-- '2017-07-14T03:40:00' prefix but lacks the '+01:00' suffix.
|
|
469
|
+
SELECT count(*) as c FROM dt_filter WHERE ts = '2017-07-14T03:40:00+01:00';
|
|
470
|
+
→ [{"c":0}]
|
|
471
|
+
|
|
472
|
+
-- The bare canonical literal matches exactly.
|
|
473
|
+
SELECT count(*) as c FROM dt_filter WHERE ts = '2017-07-14T02:40:00';
|
|
474
|
+
→ [{"c":1}]
|
|
475
|
+
|
|
476
|
+
-- Range: raw lexicographic order places bare '...02:40:00' BELOW the
|
|
477
|
+
-- Z-suffixed '...02:40:00Z' (the bare form is a proper prefix), so row 1
|
|
478
|
+
-- is included by strict-less-than and row 2 ('...03:40:00') is not.
|
|
479
|
+
SELECT ts FROM dt_filter WHERE ts < '2017-07-14T02:40:00Z';
|
|
480
|
+
→ [{"ts":"2017-07-14T02:40:00"}]
|
|
481
|
+
|
|
482
|
+
DROP TABLE dt_filter;
|
|
483
|
+
|
|
484
|
+
-- ============================================================
|
|
485
|
+
-- DATE / TIME pushed-down filter: same RAW-comparison contract.
|
|
486
|
+
-- DATE and TIME share the identical isTemporal → BINARY compare
|
|
487
|
+
-- path; a non-canonical literal denoting the same value must NOT
|
|
488
|
+
-- match the bare stored canonical form.
|
|
489
|
+
-- ============================================================
|
|
490
|
+
|
|
491
|
+
CREATE TABLE d_filter (d DATE PRIMARY KEY);
|
|
492
|
+
INSERT INTO d_filter VALUES ('2024-01-15T10:30:00Z'); -- stores bare '2024-01-15'
|
|
493
|
+
INSERT INTO d_filter VALUES ('2024-01-20');
|
|
494
|
+
-- run
|
|
495
|
+
|
|
496
|
+
SELECT count(*) as c FROM d_filter WHERE d = '2024-01-15T10:30:00Z';
|
|
497
|
+
→ [{"c":0}]
|
|
498
|
+
|
|
499
|
+
SELECT count(*) as c FROM d_filter WHERE d = '2024-01-15';
|
|
500
|
+
→ [{"c":1}]
|
|
501
|
+
|
|
502
|
+
DROP TABLE d_filter;
|
|
503
|
+
|
|
504
|
+
CREATE TABLE t_filter (t TIME PRIMARY KEY);
|
|
505
|
+
INSERT INTO t_filter VALUES ('2024-01-15T10:30:00Z'); -- stores bare '10:30:00'
|
|
506
|
+
INSERT INTO t_filter VALUES ('12:00:00');
|
|
507
|
+
-- run
|
|
508
|
+
|
|
509
|
+
SELECT count(*) as c FROM t_filter WHERE t = '2024-01-15T10:30:00Z';
|
|
510
|
+
→ [{"c":0}]
|
|
511
|
+
|
|
512
|
+
SELECT count(*) as c FROM t_filter WHERE t = '10:30:00';
|
|
513
|
+
→ [{"c":1}]
|
|
514
|
+
|
|
515
|
+
DROP TABLE t_filter;
|