@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.
Files changed (377) hide show
  1. package/README.md +2 -0
  2. package/package.json +7 -4
  3. package/test/README.md +173 -0
  4. package/test/logic/01-basic.sqllogic +39 -0
  5. package/test/logic/01.1-select-projection-extras.sqllogic +130 -0
  6. package/test/logic/01.2-strings.sqllogic +43 -0
  7. package/test/logic/01.5-insert-select.sqllogic +237 -0
  8. package/test/logic/01.6-update-extras.sqllogic +118 -0
  9. package/test/logic/01.7-update-from.sqllogic +67 -0
  10. package/test/logic/01.8-delete-extras.sqllogic +122 -0
  11. package/test/logic/01.8.1-delete-range-cow.sqllogic +115 -0
  12. package/test/logic/01.9-query-expr-dml-gates.sqllogic +32 -0
  13. package/test/logic/01.9-query-expr-dml.sqllogic +171 -0
  14. package/test/logic/01.9-query-expr-values.sqllogic +111 -0
  15. package/test/logic/01.9.1-limit-over-dml-subquery.sqllogic +119 -0
  16. package/test/logic/02-filters.sqllogic +54 -0
  17. package/test/logic/02-smoke.sqllogic +62 -0
  18. package/test/logic/02.1-bind-parameters.sqllogic +223 -0
  19. package/test/logic/03-expressions.sqllogic +190 -0
  20. package/test/logic/03.1-quoted-identifiers.sqllogic +55 -0
  21. package/test/logic/03.4-defaults.sqllogic +554 -0
  22. package/test/logic/03.4.1-default-edge-cases.sqllogic +99 -0
  23. package/test/logic/03.5-tvf.sqllogic +61 -0
  24. package/test/logic/03.6-type-system.sqllogic +544 -0
  25. package/test/logic/03.6.1-numeric-text-comparison-coercion.sqllogic +244 -0
  26. package/test/logic/03.6.2-value-to-text.sqllogic +224 -0
  27. package/test/logic/03.7-bigint-mixed-arithmetic.sqllogic +65 -0
  28. package/test/logic/03.8-not-precedence.sqllogic +255 -0
  29. package/test/logic/03.9-is-bool-predicate.sqllogic +150 -0
  30. package/test/logic/03.9.1-is-bool-predicate-partial-index.sqllogic +34 -0
  31. package/test/logic/04-order-by.sqllogic +38 -0
  32. package/test/logic/04-transactions.sqllogic +239 -0
  33. package/test/logic/04a-savepoint-lazy-attach.sqllogic +122 -0
  34. package/test/logic/05-vtab_memory.sqllogic +50 -0
  35. package/test/logic/05.0.1-vtab-memory-unique-index-collation.sqllogic +34 -0
  36. package/test/logic/05.1-composite-pk-range-scan.sqllogic +147 -0
  37. package/test/logic/05.1.1-secondary-index-range-scan.sqllogic +56 -0
  38. package/test/logic/05.2-cast-seek-correctness.sqllogic +124 -0
  39. package/test/logic/06-builtin_functions.sqllogic +149 -0
  40. package/test/logic/06.1-string-functions.sqllogic +92 -0
  41. package/test/logic/06.1.3-like-glob-edges.sqllogic +53 -0
  42. package/test/logic/06.2-math-functions.sqllogic +82 -0
  43. package/test/logic/06.3-schema.sqllogic +48 -0
  44. package/test/logic/06.3.1-schema-all-schemas.sqllogic +39 -0
  45. package/test/logic/06.3.2-schema-foreign-keys.sqllogic +208 -0
  46. package/test/logic/06.3.3-introspection-tags.sqllogic +202 -0
  47. package/test/logic/06.3.3.1-introspection-tags-index.sqllogic +74 -0
  48. package/test/logic/06.3.4-view-info.sqllogic +378 -0
  49. package/test/logic/06.3.5-column-info.sqllogic +347 -0
  50. package/test/logic/06.3.6-schema-views.sqllogic +29 -0
  51. package/test/logic/06.4-schema-search-path.sqllogic +354 -0
  52. package/test/logic/06.4.1-schema-case-insensitive.sqllogic +83 -0
  53. package/test/logic/06.4.2-collation-extras.sqllogic +472 -0
  54. package/test/logic/06.4.2.1-collation-index-access-paths.sqllogic +140 -0
  55. package/test/logic/06.4.3-write-path-collation.sqllogic +99 -0
  56. package/test/logic/06.4.4-comparison-collation-precedence.sqllogic +342 -0
  57. package/test/logic/06.4.5-any-collate-declared-keys.sqllogic +92 -0
  58. package/test/logic/06.5-polymorphic-types.sqllogic +169 -0
  59. package/test/logic/06.5.1-conversion-functions.sqllogic +173 -0
  60. package/test/logic/06.5.2-scalar-minmax.sqllogic +16 -0
  61. package/test/logic/06.5.3-undeclared-return-type-comparison.sqllogic +244 -0
  62. package/test/logic/06.5.4-declared-return-type-builtins.sqllogic +288 -0
  63. package/test/logic/06.6-aggregate-extended.sqllogic +78 -0
  64. package/test/logic/06.7-json-extended.sqllogic +53 -0
  65. package/test/logic/06.8-json-path-operators.sqllogic +99 -0
  66. package/test/logic/06.9-json-canonical-key.sqllogic +65 -0
  67. package/test/logic/06.9.1-json-coerce-once.sqllogic +417 -0
  68. package/test/logic/06.9.1.1-json-coerce-once-index.sqllogic +39 -0
  69. package/test/logic/06.9.2-json-structural-equality.sqllogic +382 -0
  70. package/test/logic/06.9.2.1-json-structural-equality-index.sqllogic +76 -0
  71. package/test/logic/06.9.3-json-index-range-seek.sqllogic +205 -0
  72. package/test/logic/07-aggregates.sqllogic +193 -0
  73. package/test/logic/07.1-aggregate-filter-clause.sqllogic +12 -0
  74. package/test/logic/07.2-aggregate-order-by.sqllogic +11 -0
  75. package/test/logic/07.3-group-by-extras.sqllogic +602 -0
  76. package/test/logic/07.3.1-group-by-order-by-key.sqllogic +164 -0
  77. package/test/logic/07.3.2-grouped-select-list-shape.sqllogic +231 -0
  78. package/test/logic/07.4-group-by-filter-composite-pk.sqllogic +120 -0
  79. package/test/logic/07.5-sum-mixed-exact-and-float.sqllogic +151 -0
  80. package/test/logic/07.5-window.sqllogic +1941 -0
  81. package/test/logic/07.5.1-window-named.sqllogic +13 -0
  82. package/test/logic/07.5.2-window-nth-value.sqllogic +13 -0
  83. package/test/logic/07.6-subqueries.sqllogic +78 -0
  84. package/test/logic/07.6.1-subquery-extras.sqllogic +93 -0
  85. package/test/logic/07.7-and-or-short-circuit.sqllogic +58 -0
  86. package/test/logic/07.7-in-subquery-caching.sqllogic +174 -0
  87. package/test/logic/07.7-scalar-agg-decorrelation.sqllogic +197 -0
  88. package/test/logic/07.7.1-in-extras.sqllogic +158 -0
  89. package/test/logic/07.7.1-scalar-agg-decorrelation-filter.sqllogic +105 -0
  90. package/test/logic/07.7.2-scalar-agg-decorrelation-nested.sqllogic +115 -0
  91. package/test/logic/07.7.3-exists-in-select-decorrelation.sqllogic +107 -0
  92. package/test/logic/07.7.4-where-conjunct-ordering.sqllogic +121 -0
  93. package/test/logic/07.7.5-filter-lost-under-index-order.sqllogic +134 -0
  94. package/test/logic/07.7.6-correlated-predicate-scope.sqllogic +178 -0
  95. package/test/logic/07.7.7-join-source-scope-shadowing.sqllogic +137 -0
  96. package/test/logic/07.7.8-correlated-ref-to-computed-column.sqllogic +165 -0
  97. package/test/logic/07.7.9-conjunct-monotonicity.sqllogic +200 -0
  98. package/test/logic/07.8-correlated-subquery-edges.sqllogic +71 -0
  99. package/test/logic/07.8.1-correlated-in-decorrelation-gates.sqllogic +156 -0
  100. package/test/logic/07.9-in-value-list.sqllogic +154 -0
  101. package/test/logic/07.9.1-in-value-list-composite-index.sqllogic +38 -0
  102. package/test/logic/08-views.sqllogic +64 -0
  103. package/test/logic/08.1-semi-anti-join.sqllogic +191 -0
  104. package/test/logic/08.1-view-edge-cases.sqllogic +118 -0
  105. package/test/logic/08.1.1-uncorrelated-in-semijoin.sqllogic +251 -0
  106. package/test/logic/08.2-existence-flag-semijoin-recovery.sqllogic +197 -0
  107. package/test/logic/08.3-existence-flag-inner-recovery.sqllogic +102 -0
  108. package/test/logic/08.4-key-set-semi-join.sqllogic +447 -0
  109. package/test/logic/09-set_operations.sqllogic +244 -0
  110. package/test/logic/09.1-set-op-cross-collation.sqllogic +230 -0
  111. package/test/logic/10-distinct_datatypes.sqllogic +127 -0
  112. package/test/logic/10.1-ddl-lifecycle.sqllogic +203 -0
  113. package/test/logic/10.1.1-create-table-syntax-edges.sqllogic +47 -0
  114. package/test/logic/10.1.2-ddl-in-transaction.sqllogic +143 -0
  115. package/test/logic/10.1.2.1-add-constraint-in-transaction.sqllogic +59 -0
  116. package/test/logic/10.1.3-ddl-drop-in-transaction.sqllogic +187 -0
  117. package/test/logic/10.1.3.1-drop-constraint-in-transaction.sqllogic +45 -0
  118. package/test/logic/10.1.4-create-table-duplicate-constraint-names.sqllogic +149 -0
  119. package/test/logic/10.1.4-ddl-transaction-policy.sqllogic +314 -0
  120. package/test/logic/10.1.5-alter-add-constraint-minted-name-disambiguation.sqllogic +219 -0
  121. package/test/logic/10.1.5-create-index-lifecycle.sqllogic +72 -0
  122. package/test/logic/10.1.6-ddl-transaction-policy-index.sqllogic +143 -0
  123. package/test/logic/10.1.7-create-table-default-type-check.sqllogic +119 -0
  124. package/test/logic/10.1.8-alter-add-check-existing-rows.sqllogic +117 -0
  125. package/test/logic/10.2-column-features.sqllogic +365 -0
  126. package/test/logic/10.2.1-table-options-rejection.sqllogic +63 -0
  127. package/test/logic/10.2.2-default-collation-memory.sqllogic +30 -0
  128. package/test/logic/10.3-function-features.sqllogic +247 -0
  129. package/test/logic/10.4-schema-scale.sqllogic +168 -0
  130. package/test/logic/10.4.1-schema-scale-indexes.sqllogic +121 -0
  131. package/test/logic/10.5-indexes.sqllogic +164 -0
  132. package/test/logic/10.5.1-partial-indexes.sqllogic +526 -0
  133. package/test/logic/10.5.2-expression-indexes.sqllogic +34 -0
  134. package/test/logic/10.5.3-desc-index-ordering.sqllogic +130 -0
  135. package/test/logic/10.5.4-composite-pk-index-update-phantom.sqllogic +55 -0
  136. package/test/logic/10.5.5-index-name-uniqueness.sqllogic +76 -0
  137. package/test/logic/10.5.6-minmax-index-boundary.sqllogic +204 -0
  138. package/test/logic/10.5.7-implicit-unique-index-lifecycle.sqllogic +1216 -0
  139. package/test/logic/10.6-distinct-edge-cases.sqllogic +119 -0
  140. package/test/logic/100-predicate-normalization-edge-cases.sqllogic +238 -0
  141. package/test/logic/100.1-where-extras.sqllogic +163 -0
  142. package/test/logic/100.1.1-where-join-on-order-indexed.sqllogic +35 -0
  143. package/test/logic/101-builtin-mutation-kills.sqllogic +974 -0
  144. package/test/logic/101-transaction-edge-cases.sqllogic +395 -0
  145. package/test/logic/102-schema-catalog-edge-cases.sqllogic +252 -0
  146. package/test/logic/102-unique-constraints.sqllogic +145 -0
  147. package/test/logic/102.0.1-schema-catalog-indexed-table.sqllogic +32 -0
  148. package/test/logic/102.1-unique-edge-cases.sqllogic +111 -0
  149. package/test/logic/102.1.1-unique-index-creation-edge-cases.sqllogic +75 -0
  150. package/test/logic/102.2-unique-collation.sqllogic +181 -0
  151. package/test/logic/102.2.1-unique-collation-index-derived.sqllogic +305 -0
  152. package/test/logic/103-database-options-edge-cases.sqllogic +108 -0
  153. package/test/logic/103.1-pragma-boolean-values.sqllogic +126 -0
  154. package/test/logic/104-emit-mutation-kills.sqllogic +236 -0
  155. package/test/logic/105-vtab-memory-mutation-kills.sqllogic +754 -0
  156. package/test/logic/105.1-vtab-memory-index-mutation-kills.sqllogic +540 -0
  157. package/test/logic/106-constraint-extractor-mutation-kills.sqllogic +350 -0
  158. package/test/logic/107-temporal-arithmetic-mutation-kills.sqllogic +833 -0
  159. package/test/logic/108-cardinality-estimation.sqllogic +146 -0
  160. package/test/logic/108.1-analyze-name-resolution.sqllogic +102 -0
  161. package/test/logic/109-aggregate-physical-selection.sqllogic +103 -0
  162. package/test/logic/11-joins.sqllogic +86 -0
  163. package/test/logic/11.1-join-using.sqllogic +267 -0
  164. package/test/logic/11.2-comma-join.sqllogic +35 -0
  165. package/test/logic/11.3-index-nested-loop-join.sqllogic +305 -0
  166. package/test/logic/11.3-mismatched-collation-join.sqllogic +74 -0
  167. package/test/logic/11.4-hash-join-side-swap.sqllogic +118 -0
  168. package/test/logic/110-scan-emitter-mutation-kills.sqllogic +121 -0
  169. package/test/logic/110.1-scan-emitter-index-scan-kills.sqllogic +47 -0
  170. package/test/logic/12-empty-primary-key.sqllogic +124 -0
  171. package/test/logic/12-join_padding_order.sqllogic +58 -0
  172. package/test/logic/12.1-orderby-index-consumption.sqllogic +40 -0
  173. package/test/logic/13-cte.sqllogic +137 -0
  174. package/test/logic/13.1-cte-multiple-recursive.sqllogic +104 -0
  175. package/test/logic/13.10-cte-qualified-name.sqllogic +136 -0
  176. package/test/logic/13.11-unreferenced-dml-cte.sqllogic +414 -0
  177. package/test/logic/13.12-nested-dml-cte-rejected.sqllogic +280 -0
  178. package/test/logic/13.2-cte-bind-params.sqllogic +98 -0
  179. package/test/logic/13.3-cte-edge-cases.sqllogic +120 -0
  180. package/test/logic/13.4-cte-extras.sqllogic +98 -0
  181. package/test/logic/13.5-cte-join-order.sqllogic +166 -0
  182. package/test/logic/13.6-cte-dml-runs-once.sqllogic +318 -0
  183. package/test/logic/13.7-cte-sibling-visibility.sqllogic +227 -0
  184. package/test/logic/13.8-insert-with-clause-visibility.sqllogic +254 -0
  185. package/test/logic/13.9-schema-authored-cte-isolation.sqllogic +328 -0
  186. package/test/logic/13.9.1-schema-authored-schema-path-isolation.sqllogic +408 -0
  187. package/test/logic/14-utilities.sqllogic +168 -0
  188. package/test/logic/15-timespan.sqllogic +279 -0
  189. package/test/logic/15.1-semantic-ordering.sqllogic +960 -0
  190. package/test/logic/15.1.1-json-check-coercion.sqllogic +178 -0
  191. package/test/logic/15.1.2-semantic-ordering-index.sqllogic +41 -0
  192. package/test/logic/15.1.3-declared-form-write-contract.sqllogic +519 -0
  193. package/test/logic/16-epoch.sqllogic +187 -0
  194. package/test/logic/17-weekday-modifier.sqllogic +78 -0
  195. package/test/logic/18-json-string-escapes.sqllogic +86 -0
  196. package/test/logic/18-strftime-extended-formats.sqllogic +68 -0
  197. package/test/logic/20-empty-single-row.sqllogic +261 -0
  198. package/test/logic/21-null-edge-cases.sqllogic +227 -0
  199. package/test/logic/21.1-where-null-comparisons.sqllogic +151 -0
  200. package/test/logic/21.1.1-where-null-comparisons-secondary-index.sqllogic +35 -0
  201. package/test/logic/21.2-between-edges.sqllogic +157 -0
  202. package/test/logic/22-boundary-values.sqllogic +175 -0
  203. package/test/logic/23-self-joins-duplicates.sqllogic +74 -0
  204. package/test/logic/24-builtin-branches.sqllogic +611 -0
  205. package/test/logic/24.1-substr-extras.sqllogic +75 -0
  206. package/test/logic/24.2-random-extras.sqllogic +39 -0
  207. package/test/logic/25-aggregate-edge-cases.sqllogic +289 -0
  208. package/test/logic/25.1-nested-aggregates.sqllogic +74 -0
  209. package/test/logic/25.2-having-edge-cases.sqllogic +318 -0
  210. package/test/logic/25.3-aggregate-isnull-empty.sqllogic +16 -0
  211. package/test/logic/25.4-groupby-fd-constant-empty.sqllogic +55 -0
  212. package/test/logic/25.5-ungrouped-aggregate-column-free-select-item.sqllogic +196 -0
  213. package/test/logic/26-join-edge-cases.sqllogic +333 -0
  214. package/test/logic/26.1-left-join-isnull-on-notnull.sqllogic +26 -0
  215. package/test/logic/26.2-left-join-on-vs-where.sqllogic +67 -0
  216. package/test/logic/26.3-join-on-constants.sqllogic +61 -0
  217. package/test/logic/26.4-join-on-is-null-nullable.sqllogic +44 -0
  218. package/test/logic/27-window-edge-cases.sqllogic +206 -0
  219. package/test/logic/27.1-window-groups-frame.sqllogic +13 -0
  220. package/test/logic/27.2-window-exclude.sqllogic +13 -0
  221. package/test/logic/27.3-window-json-aggregation.sqllogic +66 -0
  222. package/test/logic/28-set-ops-sort-edge-cases.sqllogic +444 -0
  223. package/test/logic/28.1-compound-limit-offset.sqllogic +143 -0
  224. package/test/logic/28.2-orderby-expression-extras.sqllogic +698 -0
  225. package/test/logic/28.2-set-op-branch-types.sqllogic +217 -0
  226. package/test/logic/29-constraint-edge-cases.sqllogic +442 -0
  227. package/test/logic/29.1-column-level-conflict-clause.sqllogic +171 -0
  228. package/test/logic/29.2-table-level-pk-conflict-clause.sqllogic +113 -0
  229. package/test/logic/40-constraints.sqllogic +418 -0
  230. package/test/logic/40.1-pk-desc-direction.sqllogic +76 -0
  231. package/test/logic/40.2-check-extras.sqllogic +683 -0
  232. package/test/logic/41-alter-table.sqllogic +191 -0
  233. package/test/logic/41-fk-cascade-conflict-and-self-ref.sqllogic +263 -0
  234. package/test/logic/41-fk-cross-schema.sqllogic +155 -0
  235. package/test/logic/41-fk-extended-targets.sqllogic +173 -0
  236. package/test/logic/41-foreign-keys.sqllogic +1001 -0
  237. package/test/logic/41-generated-column-errors.sqllogic +225 -0
  238. package/test/logic/41-generated-column-extras.sqllogic +598 -0
  239. package/test/logic/41-generated-column-scope.sqllogic +329 -0
  240. package/test/logic/41-generated-columns.sqllogic +361 -0
  241. package/test/logic/41.1-alter-pk.sqllogic +230 -0
  242. package/test/logic/41.1-fk-collation-conflict.sqllogic +277 -0
  243. package/test/logic/41.10-alter-drop-column-foreign-key.sqllogic +274 -0
  244. package/test/logic/41.10.1-alter-drop-column-unique-index.sqllogic +169 -0
  245. package/test/logic/41.10.2-alter-drop-column-check-and-assertion.sqllogic +1616 -0
  246. package/test/logic/41.10.3-alter-drop-column-referencing-fk.sqllogic +292 -0
  247. package/test/logic/41.10.4-drop-object-expression-dependents.sqllogic +602 -0
  248. package/test/logic/41.11-deferred-fk-with-rename.sqllogic +232 -0
  249. package/test/logic/41.12-alter-default-coercion.sqllogic +200 -0
  250. package/test/logic/41.13-alter-add-column-generated-backfill.sqllogic +566 -0
  251. package/test/logic/41.14-alter-add-column-subquery-backfill.sqllogic +129 -0
  252. package/test/logic/41.15-alter-column-default-type-check.sqllogic +178 -0
  253. package/test/logic/41.16-fk-unenforceable.sqllogic +364 -0
  254. package/test/logic/41.2-alter-column.sqllogic +382 -0
  255. package/test/logic/41.2.1-alter-column-retype-deleted-row-memory.sqllogic +32 -0
  256. package/test/logic/41.2.2-alter-column-retype-index-rebuild.sqllogic +77 -0
  257. package/test/logic/41.2.3-alter-column-set-not-null-pk-backfill.sqllogic +310 -0
  258. package/test/logic/41.2.3.1-alter-column-set-not-null-pk-backfill-secondary-index.sqllogic +37 -0
  259. package/test/logic/41.3-alter-add-column-unique.sqllogic +184 -0
  260. package/test/logic/41.3-alter-rename-propagation.sqllogic +2352 -0
  261. package/test/logic/41.3.1-alter-rename-index-propagation.sqllogic +94 -0
  262. package/test/logic/41.4-alter-add-column-constraints.sqllogic +855 -0
  263. package/test/logic/41.5-alter-misc.sqllogic +48 -0
  264. package/test/logic/41.5-cross-schema-foreign-keys.sqllogic +253 -0
  265. package/test/logic/41.6-alter-drop-rename-constraint.sqllogic +354 -0
  266. package/test/logic/41.6.1-alter-drop-constraint-index-derived.sqllogic +22 -0
  267. package/test/logic/41.7-alter-column-collate.sqllogic +105 -0
  268. package/test/logic/41.7.1-alter-column-collate-unique.sqllogic +45 -0
  269. package/test/logic/41.7.2-alter-column-collate-unique-store.sqllogic +208 -0
  270. package/test/logic/41.7.2.1-alter-column-collate-unique-index-store.sqllogic +114 -0
  271. package/test/logic/41.7.3-alter-column-retype-unique.sqllogic +293 -0
  272. package/test/logic/41.7.3.1-alter-column-retype-staged-rows-memory.sqllogic +41 -0
  273. package/test/logic/41.7.3.2-alter-column-retype-unique-index.sqllogic +72 -0
  274. package/test/logic/41.7.4-alter-column-retype-semantic-memory.sqllogic +445 -0
  275. package/test/logic/41.7.4.1-alter-column-retype-semantic-index-memory.sqllogic +91 -0
  276. package/test/logic/41.7.5-alter-column-collate-pk-staged-delete-memory.sqllogic +106 -0
  277. package/test/logic/41.8-alter-add-constraint-unique-fk.sqllogic +275 -0
  278. package/test/logic/41.8-alter-savepoint-staged-rows.sqllogic +443 -0
  279. package/test/logic/41.8.1-alter-rename-savepoint-staged-rows.sqllogic +408 -0
  280. package/test/logic/41.9-alter-constraint-body-change.sqllogic +180 -0
  281. package/test/logic/41.9-fk-restrict-batched.sqllogic +290 -0
  282. package/test/logic/42-committed-snapshot.sqllogic +254 -0
  283. package/test/logic/42-returning.sqllogic +159 -0
  284. package/test/logic/42.1-returning-extras.sqllogic +232 -0
  285. package/test/logic/42.2-returning-stored-row.sqllogic +165 -0
  286. package/test/logic/43-default-nullability.sqllogic +131 -0
  287. package/test/logic/43-transition-constraints.sqllogic +341 -0
  288. package/test/logic/43.1-default-collation.sqllogic +140 -0
  289. package/test/logic/43.1-notnull-or-conflict.sqllogic +79 -0
  290. package/test/logic/43.2-deferred-check-new-on-delete.sqllogic +95 -0
  291. package/test/logic/43.3-nullable-primary-key.sqllogic +587 -0
  292. package/test/logic/44-determinism-validation.sqllogic +164 -0
  293. package/test/logic/44-orthogonality.sqllogic +146 -0
  294. package/test/logic/44.1-nondeterministic-schema.sqllogic +316 -0
  295. package/test/logic/45-udf-determinism.sqllogic +39 -0
  296. package/test/logic/46-mutation-context.sqllogic +595 -0
  297. package/test/logic/47-upsert.sqllogic +255 -0
  298. package/test/logic/47.1-upsert-conflict-targets.sqllogic +169 -0
  299. package/test/logic/47.2-replace-and-or-clauses.sqllogic +164 -0
  300. package/test/logic/47.2.1-pk-replace-secondary-unique.sqllogic +374 -0
  301. package/test/logic/47.3-engine-or-fail.sqllogic +122 -0
  302. package/test/logic/47.3-upsert-conflict-target-collation.sqllogic +139 -0
  303. package/test/logic/47.3.1-upsert-conflict-index-derived-collation.sqllogic +25 -0
  304. package/test/logic/47.4-upsert-conflict-target-affinity.sqllogic +59 -0
  305. package/test/logic/47.5-upsert-do-update-constraints.sqllogic +440 -0
  306. package/test/logic/47.6-upsert-do-update-decomposed.sqllogic +100 -0
  307. package/test/logic/49-reference-graph.sqllogic +84 -0
  308. package/test/logic/50-declarative-schema.sqllogic +2550 -0
  309. package/test/logic/50-metadata-tags.sqllogic +1033 -0
  310. package/test/logic/50.0.1-metadata-tags-index.sqllogic +141 -0
  311. package/test/logic/50.1-declare-schema-pk.sqllogic +150 -0
  312. package/test/logic/50.2-declare-schema-renames.sqllogic +949 -0
  313. package/test/logic/50.2.1-declare-schema-index-renames.sqllogic +173 -0
  314. package/test/logic/50.3-declare-schema-duplicate-names.sqllogic +280 -0
  315. package/test/logic/50.4-declare-schema-apply-restore.sqllogic +192 -0
  316. package/test/logic/51-lens-foundation.sqllogic +147 -0
  317. package/test/logic/51-materialized-views.sqllogic +376 -0
  318. package/test/logic/51.5-materialized-views-coarsened-key.sqllogic +198 -0
  319. package/test/logic/51.7-maintained-table-attach-detach.sqllogic +468 -0
  320. package/test/logic/51.8-maintained-table-declared-constraints.sqllogic +440 -0
  321. package/test/logic/51.85-maintained-table-parent-fk.sqllogic +103 -0
  322. package/test/logic/51.9-maintained-table-secondary-unique.sqllogic +237 -0
  323. package/test/logic/51.9.1-maintained-table-partial-unique.sqllogic +36 -0
  324. package/test/logic/52-lens-overrides.sqllogic +566 -0
  325. package/test/logic/53-materialized-views-rowtime.sqllogic +1601 -0
  326. package/test/logic/53-reserved-tags.sqllogic +252 -0
  327. package/test/logic/53.1-materialized-view-write-through.sqllogic +329 -0
  328. package/test/logic/53.2-materialized-view-rename-propagation.sqllogic +483 -0
  329. package/test/logic/53.3-materialized-view-constraint-only-ddl.sqllogic +409 -0
  330. package/test/logic/53.3.1-materialized-view-index-ddl-irrelevance.sqllogic +29 -0
  331. package/test/logic/53.4-materialized-view-structural-alter-restore.sqllogic +436 -0
  332. package/test/logic/54-covering-mv-enforcement.sqllogic +314 -0
  333. package/test/logic/54.1-covering-mv-partial-enforcement.sqllogic +34 -0
  334. package/test/logic/55-internal-eviction-reporting.sqllogic +89 -0
  335. package/test/logic/55-lens-prover.sqllogic +202 -0
  336. package/test/logic/55.1-eviction-restrict-fk.sqllogic +148 -0
  337. package/test/logic/55.5-lens-authored-inverse.sqllogic +1468 -0
  338. package/test/logic/80-grow-retrieve-pass.sqllogic +79 -0
  339. package/test/logic/81-quickpick.sqllogic +24 -0
  340. package/test/logic/82-bloom-join.sqllogic +185 -0
  341. package/test/logic/83-merge-join.sqllogic +280 -0
  342. package/test/logic/84-asof-scan.sqllogic +238 -0
  343. package/test/logic/84-key-cardinality.sqllogic +50 -0
  344. package/test/logic/85-relational-const-folding.sqllogic +51 -0
  345. package/test/logic/86-scalar-cse.sqllogic +42 -0
  346. package/test/logic/90-error_paths.sqllogic +114 -0
  347. package/test/logic/90.1-parse-errors.sqllogic +77 -0
  348. package/test/logic/90.2-alter-table-errors.sqllogic +53 -0
  349. package/test/logic/90.2.1-alter-extra-errors.sqllogic +51 -0
  350. package/test/logic/90.3-expression-errors.sqllogic +43 -0
  351. package/test/logic/90.4-dml-errors.sqllogic +47 -0
  352. package/test/logic/90.5-unsupported-join-types.sqllogic +37 -0
  353. package/test/logic/90.5.1-right-full-join-read.sqllogic +157 -0
  354. package/test/logic/90.6-select-error-paths.sqllogic +57 -0
  355. package/test/logic/91-merge-join-edge-cases.sqllogic +159 -0
  356. package/test/logic/92-hash-aggregate-edge-cases.sqllogic +139 -0
  357. package/test/logic/93-ddl-view-edge-cases.sqllogic +104 -0
  358. package/test/logic/93.1-view-error-paths.sqllogic +74 -0
  359. package/test/logic/93.2-view-mutation-pending.sqllogic +108 -0
  360. package/test/logic/93.3-view-mutation-or-clause.sqllogic +60 -0
  361. package/test/logic/93.4-view-mutation.sqllogic +4881 -0
  362. package/test/logic/93.4.1-view-mutation-partial-unique-cardinality.sqllogic +31 -0
  363. package/test/logic/93.5-authored-inverse.sqllogic +415 -0
  364. package/test/logic/93.6-set-op-flagless-write.sqllogic +862 -0
  365. package/test/logic/94-tvf-edge-cases.sqllogic +58 -0
  366. package/test/logic/94.1-limit-offset-edge-cases.sqllogic +109 -0
  367. package/test/logic/94.2-limit-offset-extras.sqllogic +98 -0
  368. package/test/logic/95-assertions.sqllogic +1417 -0
  369. package/test/logic/96-subquery-edge-cases.sqllogic +276 -0
  370. package/test/logic/97-json-function-edge-cases.sqllogic +633 -0
  371. package/test/logic/97.1-json-blob-and-special-values.sqllogic +92 -0
  372. package/test/logic/98-temporal-edge-cases.sqllogic +515 -0
  373. package/test/logic/99-conversion-edge-cases.sqllogic +325 -0
  374. package/test/logic/99.0.1-schema-index-listing.sqllogic +21 -0
  375. package/test/logic/99.1-cast-syntax-extras.sqllogic +167 -0
  376. package/test/logic/drop-unique-index.sqllogic +88 -0
  377. package/test/logic/pushdown-test.sqllogic +36 -0
@@ -0,0 +1,238 @@
1
+ -- asof-scan.sqllogic — Streaming asof scan correctness via lateral-top-1 rule.
2
+ -- The rule fires only when the left input is monotonic on the match attribute,
3
+ -- so each query wraps the left side in `ORDER BY ts` (per partition or globally).
4
+ -- These cases run with the default `asof.mergeRowThreshold` (10000), keeping
5
+ -- the AsofScanNode on its `'hash'` strategy. The `'merge'` strategy's
6
+ -- equivalence is validated end-to-end in test/optimizer/asof-scan.spec.ts
7
+ -- (with `mergeRowThreshold = 0` forcing the promotion).
8
+
9
+ -- Setup: trades stream (left) and quotes stream (right, partitioned by symbol).
10
+ CREATE TABLE asof_trades (id INTEGER PRIMARY KEY, symbol TEXT, ts INTEGER);
11
+ CREATE TABLE asof_quotes (ts INTEGER PRIMARY KEY, symbol TEXT, bid REAL);
12
+
13
+ -- Trades inserted in ts order so the natural PK scan also yields ts-sorted rows
14
+ -- via id, but we still wrap the left in ORDER BY ts to keep the rule's
15
+ -- monotonicOn precondition explicit.
16
+ INSERT INTO asof_trades VALUES
17
+ (1, 'A', 75),
18
+ (2, 'A', 100),
19
+ (3, 'A', 200),
20
+ (4, 'B', 150),
21
+ (5, 'C', 500);
22
+
23
+ INSERT INTO asof_quotes VALUES
24
+ (50, 'A', 1.0),
25
+ (150, 'A', 1.5),
26
+ (180, 'B', 2.0),
27
+ (250, 'A', 2.5);
28
+
29
+ -- Plan shape: ASOF SCAN must appear in the plan (when left is sorted on ts).
30
+ SELECT op FROM query_plan('select t.id, q.bid from (select id, symbol, ts from asof_trades order by ts) t left join lateral (select bid from asof_quotes q where q.symbol = t.symbol and q.ts <= t.ts order by q.ts desc limit 1) q on true') WHERE op = 'ASOFSCAN';
31
+ → [{"op":"ASOFSCAN"}]
32
+
33
+ -- Partitioned non-strict left lateral. Left is sorted by ts.
34
+ -- t.id=1 (A,75): A quotes ≤ 75 are {50:1.0}. → 1.0
35
+ -- t.id=2 (A,100): {50:1.0}. → 1.0
36
+ -- t.id=3 (A,200): {50:1.0, 150:1.5}. → 1.5
37
+ -- t.id=4 (B,150): no B quote ≤ 150 (only ts=180 in B). → null
38
+ -- t.id=5 (C,500): no C quotes. → null
39
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
40
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
41
+ ) q ON true ORDER BY t.id;
42
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":1.5},{"id":4,"bid":null},{"id":5,"bid":null}]
43
+
44
+ -- Inner cross join lateral drops left rows with no match.
45
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t CROSS JOIN LATERAL (
46
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
47
+ ) q ORDER BY t.id;
48
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":1.5}]
49
+
50
+ -- Strict variant (q.ts < t.ts, no equality at the boundary).
51
+ -- t.id=1 (A,75): A quotes < 75 are {50:1.0}. → 1.0
52
+ -- t.id=2 (A,100): A quotes < 100 are {50:1.0}. → 1.0
53
+ -- t.id=3 (A,200): A quotes < 200 are {50, 150}. → 1.5
54
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
55
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts < t.ts ORDER BY q.ts DESC LIMIT 1
56
+ ) q ON true ORDER BY t.id;
57
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":1.5},{"id":4,"bid":null},{"id":5,"bid":null}]
58
+
59
+ -- Boundary tie: when q.ts equals t.ts, non-strict matches; strict skips.
60
+ INSERT INTO asof_quotes VALUES (100, 'A', 9.9);
61
+
62
+ -- Non-strict (=): t.id=2 (ts=100) sees the tied 9.9.
63
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
64
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
65
+ ) q ON true WHERE t.id = 2;
66
+ → [{"id":2,"bid":9.9}]
67
+
68
+ -- Strict (<): t.id=2 (ts=100) skips the tie; falls back to ts=50, bid=1.0.
69
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
70
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts < t.ts ORDER BY q.ts DESC LIMIT 1
71
+ ) q ON true WHERE t.id = 2;
72
+ → [{"id":2,"bid":1}]
73
+
74
+ DELETE FROM asof_quotes WHERE ts = 100;
75
+
76
+ -- Empty right: outer left-pads, inner drops.
77
+ DELETE FROM asof_quotes;
78
+
79
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
80
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
81
+ ) q ON true ORDER BY t.id;
82
+ → [{"id":1,"bid":null},{"id":2,"bid":null},{"id":3,"bid":null},{"id":4,"bid":null},{"id":5,"bid":null}]
83
+
84
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t CROSS JOIN LATERAL (
85
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
86
+ ) q ORDER BY t.id;
87
+ → []
88
+
89
+ -- Restore quotes for the unpartitioned case.
90
+ INSERT INTO asof_quotes VALUES
91
+ (50, 'A', 1.0),
92
+ (150, 'A', 1.5),
93
+ (180, 'B', 2.0),
94
+ (250, 'A', 2.5);
95
+
96
+ -- Unpartitioned asof: any latest quote ≤ t.ts regardless of symbol.
97
+ -- Left sorted by ts: t.id=1(75), 2(100), 4(150), 3(200), 5(500)
98
+ -- t.id=1 (75): ≤75 → 50 → 1.0
99
+ -- t.id=2 (100): ≤100 → 50 → 1.0
100
+ -- t.id=4 (150): ≤150 → 150 → 1.5
101
+ -- t.id=3 (200): ≤200 → 180 → 2.0
102
+ -- t.id=5 (500): ≤500 → 250 → 2.5
103
+ SELECT t.id, q.bid FROM (SELECT id, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
104
+ SELECT bid FROM asof_quotes q WHERE q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
105
+ ) q ON true ORDER BY t.id;
106
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":2},{"id":4,"bid":1.5},{"id":5,"bid":2.5}]
107
+
108
+ -- ASC variant plan-shape: ASOF SCAN must appear (left sorted on ts, q.ts >= t.ts ORDER BY q.ts ASC).
109
+ SELECT op FROM query_plan('select t.id, q.bid from (select id, symbol, ts from asof_trades order by ts) t left join lateral (select bid from asof_quotes q where q.symbol = t.symbol and q.ts >= t.ts order by q.ts asc limit 1) q on true') WHERE op = 'ASOFSCAN';
110
+ → [{"op":"ASOFSCAN"}]
111
+
112
+ -- Partitioned non-strict ASC lateral. Left sorted by ts.
113
+ -- A quotes by ts: 50, 150, 250 ; B quotes by ts: 180
114
+ -- t.id=1 (A,75): earliest A ≥ 75 → 150 → 1.5
115
+ -- t.id=2 (A,100): earliest A ≥ 100 → 150 → 1.5
116
+ -- t.id=4 (B,150): earliest B ≥ 150 → 180 → 2.0
117
+ -- t.id=3 (A,200): earliest A ≥ 200 → 250 → 2.5
118
+ -- t.id=5 (C,500): no C quote → null
119
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
120
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts >= t.ts ORDER BY q.ts ASC LIMIT 1
121
+ ) q ON true ORDER BY t.id;
122
+ → [{"id":1,"bid":1.5},{"id":2,"bid":1.5},{"id":3,"bid":2.5},{"id":4,"bid":2},{"id":5,"bid":null}]
123
+
124
+ -- Strict ASC variant (q.ts > t.ts) — boundary tie at q.ts = t.ts is excluded.
125
+ -- Add an exact-match quote to exercise the tie.
126
+ INSERT INTO asof_quotes VALUES (200, 'A', 7.7);
127
+
128
+ -- Non-strict ASC: t.id=3 (ts=200) sees the tied 7.7.
129
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
130
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts >= t.ts ORDER BY q.ts ASC LIMIT 1
131
+ ) q ON true WHERE t.id = 3;
132
+ → [{"id":3,"bid":7.7}]
133
+
134
+ -- Strict ASC: t.id=3 (ts=200) skips the tie; falls through to ts=250 → 2.5.
135
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
136
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts > t.ts ORDER BY q.ts ASC LIMIT 1
137
+ ) q ON true WHERE t.id = 3;
138
+ → [{"id":3,"bid":2.5}]
139
+
140
+ DELETE FROM asof_quotes WHERE ts = 200 AND bid = 7.7;
141
+
142
+ -- Inner cross-join lateral (ASC) drops left rows with no match.
143
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades ORDER BY ts) t CROSS JOIN LATERAL (
144
+ SELECT bid FROM asof_quotes q WHERE q.symbol = t.symbol AND q.ts >= t.ts ORDER BY q.ts ASC LIMIT 1
145
+ ) q ORDER BY t.id;
146
+ → [{"id":1,"bid":1.5},{"id":2,"bid":1.5},{"id":3,"bid":2.5},{"id":4,"bid":2}]
147
+
148
+ -- Unpartitioned ASC: any earliest quote ≥ t.ts regardless of symbol.
149
+ -- All quotes by ts: 50, 150, 180, 250
150
+ -- t.id=1 (75): earliest ≥ 75 → 150 → 1.5
151
+ -- t.id=2 (100): earliest ≥ 100 → 150 → 1.5
152
+ -- t.id=4 (150): earliest ≥ 150 → 150 → 1.5
153
+ -- t.id=3 (200): earliest ≥ 200 → 250 → 2.5
154
+ -- t.id=5 (500): earliest ≥ 500 → none → null
155
+ SELECT t.id, q.bid FROM (SELECT id, ts FROM asof_trades ORDER BY ts) t LEFT JOIN LATERAL (
156
+ SELECT bid FROM asof_quotes q WHERE q.ts >= t.ts ORDER BY q.ts ASC LIMIT 1
157
+ ) q ON true ORDER BY t.id;
158
+ → [{"id":1,"bid":1.5},{"id":2,"bid":1.5},{"id":3,"bid":2.5},{"id":4,"bid":1.5},{"id":5,"bid":null}]
159
+
160
+ -- NOCASE partition: 'A' on the left must match the 'a' bucket on the right.
161
+ CREATE TABLE asof_trades_ci (id INTEGER PRIMARY KEY, symbol TEXT COLLATE NOCASE, ts INTEGER);
162
+ CREATE TABLE asof_quotes_ci (ts INTEGER PRIMARY KEY, symbol TEXT COLLATE NOCASE, bid REAL);
163
+
164
+ INSERT INTO asof_trades_ci VALUES
165
+ (1, 'A', 100),
166
+ (2, 'a', 200),
167
+ (3, 'B', 150);
168
+
169
+ -- Right side uses lowercase; under NOCASE these must still bucket together.
170
+ INSERT INTO asof_quotes_ci VALUES
171
+ (50, 'a', 1.0),
172
+ (180, 'b', 2.0);
173
+
174
+ -- Partitioned non-strict desc: each left row finds the right bucket regardless of case.
175
+ -- t.id=1 (A,100): A/a quotes ≤ 100 → 50 → 1.0
176
+ -- t.id=2 (a,200): A/a quotes ≤ 200 → 50 → 1.0
177
+ -- t.id=3 (B,150): B/b quotes ≤ 150 → none (only ts=180) → null
178
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades_ci ORDER BY ts) t LEFT JOIN LATERAL (
179
+ SELECT bid FROM asof_quotes_ci q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
180
+ ) q ON true ORDER BY t.id;
181
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":null}]
182
+
183
+ DROP TABLE asof_trades_ci;
184
+ DROP TABLE asof_quotes_ci;
185
+
186
+ -- RTRIM partition: trailing-space differences must collapse into the same bucket.
187
+ CREATE TABLE asof_trades_rt (id INTEGER PRIMARY KEY, symbol TEXT COLLATE RTRIM, ts INTEGER);
188
+ CREATE TABLE asof_quotes_rt (ts INTEGER PRIMARY KEY, symbol TEXT COLLATE RTRIM, bid REAL);
189
+
190
+ INSERT INTO asof_trades_rt VALUES
191
+ (1, 'B ', 100),
192
+ (2, 'B ', 200);
193
+
194
+ INSERT INTO asof_quotes_rt VALUES
195
+ (50, 'B', 3.0);
196
+
197
+ -- Both left rows ('B ', 'B ') match right bucket 'B' under COLLATE RTRIM.
198
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades_rt ORDER BY ts) t LEFT JOIN LATERAL (
199
+ SELECT bid FROM asof_quotes_rt q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
200
+ ) q ON true ORDER BY t.id;
201
+ → [{"id":1,"bid":3},{"id":2,"bid":3}]
202
+
203
+ DROP TABLE asof_trades_rt;
204
+ DROP TABLE asof_quotes_rt;
205
+
206
+ -- Asymmetric partition collation (ticket join-key-collation-resolution-alignment):
207
+ -- ONLY the right (quotes) side declares NOCASE; the left (trades) side defaults to
208
+ -- BINARY. The partition comparison resolves through the shared provenance lattice
209
+ -- to NOCASE (a declared collation outranks a defaulted BINARY) regardless of which
210
+ -- side spells it — so 'A' on the left still buckets with 'a' on the right. The
211
+ -- pre-alignment left-first `leftType.collationName ?? rightType.collationName`
212
+ -- picked the left's defaulted BINARY and the buckets diverged.
213
+ CREATE TABLE asof_trades_mix (id INTEGER PRIMARY KEY, symbol TEXT, ts INTEGER);
214
+ CREATE TABLE asof_quotes_mix (ts INTEGER PRIMARY KEY, symbol TEXT COLLATE NOCASE, bid REAL);
215
+
216
+ INSERT INTO asof_trades_mix VALUES (1, 'A', 100), (2, 'a', 200), (3, 'B', 150);
217
+ INSERT INTO asof_quotes_mix VALUES (50, 'a', 1.0), (180, 'b', 2.0);
218
+
219
+ -- This must remain an ASOFSCAN — the partition-collation resolution under review
220
+ -- only runs in the asof emitter; if the plan ever degraded to a generic correlated
221
+ -- subquery the result assertion below would pass vacuously without exercising it.
222
+ SELECT op FROM query_plan('select t.id, q.bid from (select id, symbol, ts from asof_trades_mix order by ts) t left join lateral (select bid from asof_quotes_mix q where q.symbol = t.symbol and q.ts <= t.ts order by q.ts desc limit 1) q on true') WHERE op = 'ASOFSCAN';
223
+ → [{"op":"ASOFSCAN"}]
224
+
225
+ -- t.id=1 (A,100): A/a quotes ≤ 100 → ts=50 → 1.0
226
+ -- t.id=2 (a,200): A/a quotes ≤ 200 → ts=50 → 1.0
227
+ -- t.id=3 (B,150): B/b quotes ≤ 150 → none (only ts=180) → null
228
+ SELECT t.id, q.bid FROM (SELECT id, symbol, ts FROM asof_trades_mix ORDER BY ts) t LEFT JOIN LATERAL (
229
+ SELECT bid FROM asof_quotes_mix q WHERE q.symbol = t.symbol AND q.ts <= t.ts ORDER BY q.ts DESC LIMIT 1
230
+ ) q ON true ORDER BY t.id;
231
+ → [{"id":1,"bid":1},{"id":2,"bid":1},{"id":3,"bid":null}]
232
+
233
+ DROP TABLE asof_trades_mix;
234
+ DROP TABLE asof_quotes_mix;
235
+
236
+ -- Cleanup
237
+ DROP TABLE asof_trades;
238
+ DROP TABLE asof_quotes;
@@ -0,0 +1,50 @@
1
+ -- key-cardinality.sqllogic - Key-driven cardinality and DISTINCT elimination tests
2
+
3
+ -- Setup: customers (PK) and orders (FK → customers)
4
+ CREATE TABLE kc_customers (id INTEGER PRIMARY KEY, name TEXT);
5
+ CREATE TABLE kc_orders (oid INTEGER PRIMARY KEY, customer_id INTEGER, amount INTEGER);
6
+
7
+ INSERT INTO kc_customers VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Carol');
8
+ INSERT INTO kc_orders VALUES (100, 1, 50), (101, 1, 75), (102, 2, 30), (103, 3, 10);
9
+
10
+ -- FK→PK join: orders JOIN customers ON customer_id = id
11
+ -- PK side (customers.id) is covered, so uniqueKeys should be preserved
12
+ SELECT o.oid, c.name FROM kc_orders o INNER JOIN kc_customers c ON o.customer_id = c.id ORDER BY o.oid;
13
+ → [{"oid":100,"name":"Alice"},{"oid":101,"name":"Alice"},{"oid":102,"name":"Bob"},{"oid":103,"name":"Carol"}]
14
+
15
+ -- Reverse join direction should also work
16
+ SELECT o.oid, c.name FROM kc_customers c INNER JOIN kc_orders o ON c.id = o.customer_id ORDER BY o.oid;
17
+ → [{"oid":100,"name":"Alice"},{"oid":101,"name":"Alice"},{"oid":102,"name":"Bob"},{"oid":103,"name":"Carol"}]
18
+
19
+ -- DISTINCT on PK column is redundant — should be eliminated
20
+ SELECT DISTINCT id FROM kc_customers ORDER BY id;
21
+ → [{"id":1},{"id":2},{"id":3}]
22
+
23
+ -- DISTINCT on non-key column is NOT redundant — should still work
24
+ SELECT DISTINCT customer_id FROM kc_orders ORDER BY customer_id;
25
+ → [{"customer_id":1},{"customer_id":2},{"customer_id":3}]
26
+
27
+ -- Unique constraint test
28
+ CREATE TABLE kc_users (id INTEGER PRIMARY KEY, email TEXT UNIQUE, name TEXT);
29
+ INSERT INTO kc_users VALUES (1, 'alice@test.com', 'Alice'), (2, 'bob@test.com', 'Bob');
30
+
31
+ -- Join on unique column: email is a unique key, so PK-like behavior
32
+ CREATE TABLE kc_logins (login_email TEXT, ts INTEGER);
33
+ INSERT INTO kc_logins VALUES ('alice@test.com', 1000), ('bob@test.com', 2000), ('alice@test.com', 3000);
34
+
35
+ SELECT l.ts, u.name FROM kc_logins l INNER JOIN kc_users u ON l.login_email = u.email ORDER BY l.ts;
36
+ → [{"ts":1000,"name":"Alice"},{"ts":2000,"name":"Bob"},{"ts":3000,"name":"Alice"}]
37
+
38
+ -- Multi-table join with keys
39
+ CREATE TABLE kc_products (pid INTEGER PRIMARY KEY, pname TEXT);
40
+ CREATE TABLE kc_order_items (item_id INTEGER PRIMARY KEY, order_id INTEGER, product_id INTEGER);
41
+
42
+ INSERT INTO kc_products VALUES (1, 'Widget'), (2, 'Gadget');
43
+ INSERT INTO kc_order_items VALUES (1, 100, 1), (2, 100, 2), (3, 101, 1);
44
+
45
+ SELECT oi.item_id, o.oid, p.pname
46
+ FROM kc_order_items oi
47
+ INNER JOIN kc_orders o ON oi.order_id = o.oid
48
+ INNER JOIN kc_products p ON oi.product_id = p.pid
49
+ ORDER BY oi.item_id;
50
+ → [{"item_id":1,"oid":100,"pname":"Widget"},{"item_id":2,"oid":100,"pname":"Gadget"},{"item_id":3,"oid":101,"pname":"Widget"}]
@@ -0,0 +1,51 @@
1
+ -- Tests for relational constant folding
2
+ -- Verifies that constant relational subtrees are folded into TableLiteralNodes
3
+
4
+ -- Basic VALUES folding: all-literal VALUES should fold to TableLiteral
5
+ SELECT id, name FROM (VALUES (1, 'a'), (2, 'b')) AS t(id, name);
6
+ → [{"id": 1, "name": "a"}, {"id": 2, "name": "b"}]
7
+
8
+ -- Constant subquery folding: constant projections over SingleRow
9
+ SELECT * FROM (SELECT 1 + 2 AS x, 'hello' AS y);
10
+ → [{"x": 3, "y": "hello"}]
11
+
12
+ -- Nested constant VALUES with expressions
13
+ SELECT num, str FROM (VALUES (1 + 1, 'a' || 'b'), (3 * 2, 'cd')) AS t(num, str);
14
+ → [{"num": 2, "str": "ab"}, {"num": 6, "str": "cd"}]
15
+
16
+ -- Table references should NOT be folded
17
+ CREATE TABLE fold_test (id INTEGER PRIMARY KEY, name TEXT) USING memory;
18
+ INSERT INTO fold_test VALUES (1, 'Alice'), (2, 'Bob');
19
+
20
+ SELECT * FROM fold_test ORDER BY id;
21
+ → [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
22
+
23
+ -- Mixed: constant subquery joined with table (table part not folded)
24
+ SELECT f.name, c.val FROM fold_test f JOIN (VALUES (10), (20)) AS c(val) ON f.id = 1 ORDER BY c.val;
25
+ → [{"name": "Alice", "val": 10}, {"name": "Alice", "val": 20}]
26
+
27
+ -- Constant expression over VALUES with WHERE clause
28
+ SELECT id, letter FROM (VALUES (1, 'x'), (2, 'y'), (3, 'z')) AS t(id, letter) WHERE id > 1;
29
+ → [{"id": 2, "letter": "y"}, {"id": 3, "letter": "z"}]
30
+
31
+ -- Prepared statement re-execution: same results on second run
32
+ SELECT a, b FROM (VALUES (100, 200), (300, 400)) AS t(a, b);
33
+ → [{"a": 100, "b": 200}, {"a": 300, "b": 400}]
34
+
35
+ SELECT a, b FROM (VALUES (100, 200), (300, 400)) AS t(a, b);
36
+ → [{"a": 100, "b": 200}, {"a": 300, "b": 400}]
37
+
38
+ -- Single-row constant subquery
39
+ SELECT * FROM (SELECT 42 AS answer);
40
+ → [{"answer": 42}]
41
+
42
+ -- Constant with null values
43
+ SELECT a, b FROM (VALUES (1, null), (null, 'text')) AS t(a, b);
44
+ → [{"a": 1, "b": null}, {"a": null, "b": "text"}]
45
+
46
+ -- Boolean constant folding in VALUES
47
+ SELECT a, b FROM (VALUES (1 > 0, 2 < 1)) AS t(a, b);
48
+ → [{"a": true, "b": false}]
49
+
50
+ -- Cleanup
51
+ DROP TABLE fold_test;
@@ -0,0 +1,42 @@
1
+ -- scalar-cse.sqllogic - Scalar common subexpression elimination tests
2
+
3
+ CREATE TABLE t (id INTEGER PRIMARY KEY, name TEXT, value INTEGER) USING memory;
4
+ INSERT INTO t VALUES (1, 'alpha', 10), (2, 'beta', 20), (3, 'gamma', 5), (4, 'delta', 15);
5
+
6
+ CREATE TABLE orders (id INTEGER PRIMARY KEY, price INTEGER, qty INTEGER) USING memory;
7
+ INSERT INTO orders VALUES (1, 10, 5), (2, 20, 3), (3, 5, 100), (4, 8, 2);
8
+
9
+ -- Function shared between projection and filter
10
+ select length(name) as len FROM t WHERE length(name) > 4 ORDER BY id;
11
+ → [{"len":5},{"len":5},{"len":5}]
12
+
13
+ -- Arithmetic expression shared across projection, filter, and ORDER BY
14
+ select price * qty as total FROM orders WHERE price * qty > 20 ORDER BY price * qty;
15
+ → [{"total":50},{"total":60},{"total":500}]
16
+
17
+ -- Multiple filter conditions sharing same expression
18
+ select length(name) as len FROM t WHERE length(name) > 3 AND length(name) < 6 ORDER BY id;
19
+ → [{"len":5},{"len":4},{"len":5},{"len":5}]
20
+
21
+ -- Intra-projection duplicates
22
+ select length(name) as len1, length(name) as len2 FROM t WHERE id = 1;
23
+ → [{"len1":5,"len2":5}]
24
+
25
+ -- Expression in projection and ORDER BY
26
+ select value * 2 as doubled FROM t ORDER BY value * 2;
27
+ → [{"doubled":10},{"doubled":20},{"doubled":30},{"doubled":40}]
28
+
29
+ -- Bare column references NOT affected (cheap to recompute)
30
+ select name FROM t WHERE name > 'b' ORDER BY name;
31
+ → [{"name":"beta"},{"name":"delta"},{"name":"gamma"}]
32
+
33
+ -- Nested function calls with shared subexpression
34
+ select upper(name) as u FROM t WHERE length(upper(name)) > 4 ORDER BY upper(name);
35
+ → [{"u":"ALPHA"},{"u":"DELTA"},{"u":"GAMMA"}]
36
+
37
+ -- No duplicates, no transformation needed
38
+ select length(name) as len, value * 2 as doubled FROM t WHERE id = 1;
39
+ → [{"len":5,"doubled":20}]
40
+
41
+ DROP TABLE orders;
42
+ DROP TABLE t;
@@ -0,0 +1,114 @@
1
+ -- error_paths.sqllogic - Testing expected error conditions
2
+
3
+ -- Syntax Error: Incomplete statement
4
+ SELECT * FROM;
5
+ -- error: Expected table name. (at line 1, column 14)
6
+
7
+ -- Syntax Error: Misspelled keyword
8
+ CREAT TABLE t_err (a);
9
+ -- error: Expected statement type (SELECT, INSERT, UPDATE, DELETE, VALUES, CREATE, etc.), got 'CREAT'. (at line 1, column 1)
10
+
11
+ -- Semantic Error: Table not found
12
+ SELECT * FROM non_existent_table;
13
+ -- error: not found in schema path
14
+
15
+ -- Semantic Error: Column not found
16
+ CREATE TABLE t_err_col (a INTEGER);
17
+ INSERT INTO t_err_col VALUES (1);
18
+ SELECT b FROM t_err_col;
19
+ -- error: Column not found: b
20
+ DROP TABLE t_err_col;
21
+
22
+ -- Semantic Error: Ambiguous column
23
+ CREATE TABLE t_amb1 (id INTEGER, name TEXT);
24
+ CREATE TABLE t_amb2 (id INTEGER, value TEXT);
25
+ INSERT INTO t_amb1 VALUES (1, 'A');
26
+ INSERT INTO t_amb2 VALUES (1, 'X');
27
+ SELECT id FROM t_amb1 JOIN t_amb2 ON t_amb1.id = t_amb2.id;
28
+ -- error: ambiguous column name: id
29
+ DROP TABLE t_amb1;
30
+ DROP TABLE t_amb2;
31
+
32
+ -- Semantic Success: Qualified columns resolve correctly in JOIN
33
+ CREATE TABLE t_qual1 (id INTEGER, name TEXT);
34
+ CREATE TABLE t_qual2 (id INTEGER, value TEXT);
35
+ INSERT INTO t_qual1 VALUES (1, 'A'), (2, 'B');
36
+ INSERT INTO t_qual2 VALUES (1, 'X'), (3, 'Y');
37
+ SELECT a.id AS a_id, a.name, b.id AS b_id, b.value FROM t_qual1 a JOIN t_qual2 b ON a.id = b.id ORDER BY a.id;
38
+ → [{"a_id":1,"name":"A","b_id":1,"value":"X"}]
39
+ DROP TABLE t_qual1;
40
+ DROP TABLE t_qual2;
41
+
42
+ -- Semantic Success: Projection alias shadows input columns in ORDER BY
43
+ CREATE TABLE t_order_shadow (id INTEGER, name TEXT);
44
+ INSERT INTO t_order_shadow VALUES (1, 'Z'), (2, 'A'), (3, 'M');
45
+ SELECT id AS name, name AS id FROM t_order_shadow ORDER BY name;
46
+ → [{"name":1,"id":"Z"},{"name":2,"id":"A"},{"name":3,"id":"M"}]
47
+ SELECT id AS name, name AS id FROM t_order_shadow ORDER BY name DESC;
48
+ → [{"name":3,"id":"M"},{"name":2,"id":"A"},{"name":1,"id":"Z"}]
49
+ DROP TABLE t_order_shadow;
50
+
51
+ -- Semantic Success: CTE name shadows table name
52
+ CREATE TABLE t_cte_shadow (id INTEGER, name TEXT);
53
+ INSERT INTO t_cte_shadow VALUES (1, 'Table'), (2, 'Data');
54
+ WITH t_cte_shadow AS (SELECT 10 AS id, 'CTE' AS name)
55
+ SELECT * FROM t_cte_shadow ORDER BY id;
56
+ → [{"id":10,"name":"CTE"}]
57
+ SELECT * FROM t_cte_shadow ORDER BY id;
58
+ → [{"id":1,"name":"Table"},{"id":2,"name":"Data"}]
59
+ DROP TABLE t_cte_shadow;
60
+
61
+ -- Semantic Error: Function not found
62
+ SELECT non_existent_function(1);
63
+ -- error: Function not found: non_existent_function/1
64
+
65
+ -- Runtime Error: Division by zero (SQLite returns NULL)
66
+ SELECT 1 / 0;
67
+ → [{"1 / 0":null}]
68
+
69
+ -- Runtime Error: CAST behavior (SQLite tries to convert)
70
+ SELECT cast(x'01' as INTEGER);
71
+ → [{"cast(x'01' as integer)":0}]
72
+
73
+ -- Constraint Error: Primary Key Violation (when enforced)
74
+ CREATE TABLE t_pk (id INTEGER PRIMARY KEY);
75
+ INSERT INTO t_pk VALUES (1);
76
+ INSERT INTO t_pk VALUES (1);
77
+ -- error: UNIQUE constraint failed: t_pk PK.
78
+ DROP TABLE t_pk;
79
+
80
+ -- Subquery Error: Multiple rows returned where one expected
81
+ CREATE TABLE t_sub (id INTEGER, val TEXT);
82
+ INSERT INTO t_sub VALUES (1, 'a'), (2, 'b');
83
+ SELECT (SELECT val FROM t_sub);
84
+ -- error: subquery returned more than one row
85
+ DROP TABLE t_sub;
86
+
87
+ -- Type Error: Invalid type conversion in strict context
88
+ SELECT CAST('not_a_number' AS INTEGER) WHERE 0;
89
+ -- May succeed with value 0 depending on implementation
90
+
91
+ -- Parse error with location info on multi-line statement
92
+ SELECT
93
+ *
94
+ FROM
95
+ WHERE 1;
96
+ -- error: Expected table name.
97
+
98
+ -- NOT NULL constraint via UPDATE to NULL
99
+ CREATE TABLE t_nn_upd (id INTEGER PRIMARY KEY, name TEXT);
100
+ INSERT INTO t_nn_upd VALUES (1, 'hello');
101
+ UPDATE t_nn_upd SET name = NULL WHERE id = 1;
102
+ -- error: NOT NULL constraint failed: t_nn_upd.name
103
+ DROP TABLE t_nn_upd;
104
+
105
+ -- CHECK constraint violation
106
+ CREATE TABLE t_chk (id INTEGER PRIMARY KEY, val INTEGER CHECK (val > 0));
107
+ INSERT INTO t_chk VALUES (1, 10);
108
+ INSERT INTO t_chk VALUES (2, -5);
109
+ -- error: CHECK constraint failed
110
+ DROP TABLE t_chk;
111
+
112
+ -- Misuse Error: Trying to use closed DB (cannot test directly in sqllogic)
113
+
114
+ -- Misuse Error: Using finalized statement (cannot test directly in sqllogic)
@@ -0,0 +1,77 @@
1
+ -- 90.1-parse-errors.sqllogic - Parser/syntax error edge cases
2
+ -- Tests parse errors not already covered in 90-error_paths.sqllogic
3
+
4
+ -- Unterminated parenthesis in function call
5
+ SELECT abs(1
6
+ -- error: Unterminated '('
7
+
8
+ -- CTE: missing name
9
+ WITH AS (SELECT 1) SELECT 1;
10
+ -- error: Expected CTE name
11
+
12
+ -- CTE: missing AS keyword
13
+ WITH c SELECT * FROM c;
14
+ -- error: Expected 'AS' after CTE name
15
+
16
+ -- CTE: non-identifier in column list
17
+ WITH c (1) AS (SELECT 1) SELECT * FROM c;
18
+ -- error: Expected column name in CTE definition
19
+
20
+ -- CTE: missing opening paren for query
21
+ WITH c AS SELECT 1;
22
+ -- error: Expected '(' before CTE query
23
+
24
+ -- Unterminated string literal
25
+ SELECT 'unterminated;
26
+ -- error: Unterminated string
27
+
28
+ -- Incomplete CREATE statement
29
+ CREATE;
30
+ -- error: Expected TABLE,
31
+
32
+ -- Incomplete INSERT (missing table name)
33
+ INSERT INTO;
34
+ -- error: Expected table name
35
+
36
+ -- Incomplete UPDATE (missing table name)
37
+ UPDATE;
38
+ -- error: Expected table name
39
+
40
+ -- Incomplete DELETE (missing table)
41
+ DELETE;
42
+ -- error: Expected table name
43
+
44
+ -- Missing column list or VALUES in CREATE TABLE
45
+ CREATE TABLE t_parse_empty ();
46
+ -- error: Expected column
47
+
48
+ -- DROP with unsupported object type
49
+ DROP TRIGGER some_trigger;
50
+ -- error: Expected TABLE, VIEW, MATERIALIZED VIEW, INDEX, or ASSERTION after DROP
51
+
52
+ -- Incomplete CASE expression
53
+ SELECT CASE WHEN 1 THEN 2;
54
+ -- error: Expected 'END'
55
+
56
+ -- Missing expression after WHERE
57
+ CREATE TABLE t_parse_where (id INTEGER);
58
+ -- run
59
+
60
+ SELECT * FROM t_parse_where WHERE;
61
+ -- error: Expected expression
62
+
63
+ DROP TABLE t_parse_where;
64
+ -- run
65
+
66
+ -- @-prefixed parameter form (not supported in Quereus; lexer rejects)
67
+ SELECT 1 WHERE 1 = @x;
68
+ -- error: Unexpected character
69
+
70
+ -- ?-followed-by-digit (sqlite ?N form not supported; ? is consumed
71
+ -- as positional placeholder, leaving the digit as a stray token)
72
+ SELECT 1 WHERE 1 = ?1;
73
+ -- error:
74
+
75
+ -- Named parameter prefix with neither identifier nor integer
76
+ SELECT :;
77
+ -- error: Expected identifier or number after parameter prefix
@@ -0,0 +1,53 @@
1
+ -- 90.2-alter-table-errors.sqllogic - ALTER TABLE error paths
2
+ -- Tests ALTER TABLE error conditions not already covered in 41-alter-table.sqllogic
3
+
4
+ -- Setup
5
+ CREATE TABLE t_alt_rename (a INTEGER, b INTEGER);
6
+ -- run
7
+
8
+ -- RENAME COLUMN: source column not found
9
+ ALTER TABLE t_alt_rename RENAME COLUMN c TO d;
10
+ -- error: Column 'c' not found in table 't_alt_rename'
11
+
12
+ -- RENAME COLUMN: target column name already exists
13
+ ALTER TABLE t_alt_rename RENAME COLUMN a TO b;
14
+ -- error: Column 'b' already exists in table 't_alt_rename'
15
+
16
+ DROP TABLE t_alt_rename;
17
+ -- run
18
+
19
+ -- DROP COLUMN: column not found
20
+ CREATE TABLE t_alt_drop (a INTEGER, b INTEGER);
21
+ -- run
22
+
23
+ ALTER TABLE t_alt_drop DROP COLUMN c;
24
+ -- error: Column 'c' not found
25
+
26
+ -- DROP COLUMN: cannot drop primary key column
27
+ DROP TABLE t_alt_drop;
28
+ CREATE TABLE t_alt_pk (id INTEGER PRIMARY KEY, val INTEGER);
29
+ -- run
30
+
31
+ ALTER TABLE t_alt_pk DROP COLUMN id;
32
+ -- error: Cannot drop PRIMARY KEY column
33
+
34
+ -- DROP COLUMN: single column is implicitly PK in key-based system
35
+ DROP TABLE t_alt_pk;
36
+ CREATE TABLE t_alt_single (only_col INTEGER);
37
+ -- run
38
+
39
+ ALTER TABLE t_alt_single DROP COLUMN only_col;
40
+ -- error: Cannot drop PRIMARY KEY column
41
+
42
+ -- RENAME TABLE: target table already exists
43
+ DROP TABLE t_alt_single;
44
+ CREATE TABLE t_alt_src (a INTEGER);
45
+ CREATE TABLE t_alt_dst (b INTEGER);
46
+ -- run
47
+
48
+ ALTER TABLE t_alt_src RENAME TO t_alt_dst;
49
+ -- error: Table 't_alt_dst' already exists
50
+
51
+ -- Cleanup
52
+ DROP TABLE t_alt_src;
53
+ DROP TABLE t_alt_dst;
@@ -0,0 +1,51 @@
1
+ -- adapted from SQLite test/alter*.test
2
+ -- Additional ALTER TABLE error paths beyond 90.2-alter-table-errors.
3
+
4
+ -- ===================================
5
+ -- 1. ALTER on non-existent table
6
+ -- ===================================
7
+
8
+ alter table no_such_table rename to other;
9
+ -- error: not found
10
+
11
+ alter table no_such_table add column x integer null;
12
+ -- error: not found
13
+
14
+ alter table no_such_table drop column x;
15
+ -- error: not found
16
+
17
+ -- ===================================
18
+ -- 2. ALTER TABLE with non-constant DEFAULT in ADD COLUMN
19
+ -- ===================================
20
+ -- Quereus rejects non-deterministic / parameterized defaults at DDL time
21
+ -- per the determinism rule. Constant numeric and string defaults work.
22
+
23
+ create table t_alt_nc (id integer primary key, a integer not null);
24
+ insert into t_alt_nc values (1, 1);
25
+
26
+ -- bind parameter in DEFAULT rejected
27
+ alter table t_alt_nc add column p text default (:foo);
28
+ -- error:
29
+
30
+ -- column reference in DEFAULT rejected
31
+ alter table t_alt_nc add column q integer default (a + 1);
32
+ -- error:
33
+
34
+ drop table t_alt_nc;
35
+
36
+ -- ===================================
37
+ -- 3. ADD COLUMN whose backfill default would violate a CHECK
38
+ -- ===================================
39
+
40
+ create table t_bf (id integer primary key, a integer not null);
41
+ insert into t_bf values (1, 5), (2, 0);
42
+
43
+ -- default 0 backfilled into 'd', but CHECK requires d <> 0 → ALTER fails
44
+ alter table t_bf add column d integer not null default 0 check (d <> 0);
45
+ -- error:
46
+
47
+ -- table unchanged
48
+ select * from t_bf order by id;
49
+ → [{"id":1,"a":5},{"id":2,"a":0}]
50
+
51
+ drop table t_bf;