@quereus/quereus 4.4.0 → 4.5.0

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 (491) hide show
  1. package/README.md +6 -1
  2. package/dist/src/common/types.d.ts +9 -0
  3. package/dist/src/common/types.d.ts.map +1 -1
  4. package/dist/src/common/types.js.map +1 -1
  5. package/dist/src/core/database-events.d.ts +49 -0
  6. package/dist/src/core/database-events.d.ts.map +1 -1
  7. package/dist/src/core/database-events.js +148 -0
  8. package/dist/src/core/database-events.js.map +1 -1
  9. package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
  10. package/dist/src/core/database-materialized-views-analysis.js +1 -0
  11. package/dist/src/core/database-materialized-views-analysis.js.map +1 -1
  12. package/dist/src/core/database-materialized-views-plan-builders.d.ts +2 -1
  13. package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
  14. package/dist/src/core/database-materialized-views-plan-builders.js +26 -5
  15. package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
  16. package/dist/src/core/database-materialized-views-plans.d.ts +6 -3
  17. package/dist/src/core/database-materialized-views-plans.d.ts.map +1 -1
  18. package/dist/src/core/database-materialized-views.d.ts +3 -2
  19. package/dist/src/core/database-materialized-views.d.ts.map +1 -1
  20. package/dist/src/core/database-materialized-views.js +26 -5
  21. package/dist/src/core/database-materialized-views.js.map +1 -1
  22. package/dist/src/core/database.d.ts +5 -0
  23. package/dist/src/core/database.d.ts.map +1 -1
  24. package/dist/src/core/database.js +21 -1
  25. package/dist/src/core/database.js.map +1 -1
  26. package/dist/src/core/internal-statement-cache.d.ts +18 -0
  27. package/dist/src/core/internal-statement-cache.d.ts.map +1 -0
  28. package/dist/src/core/internal-statement-cache.js +211 -0
  29. package/dist/src/core/internal-statement-cache.js.map +1 -0
  30. package/dist/src/func/builtins/aggregate.d.ts +13 -12
  31. package/dist/src/func/builtins/aggregate.d.ts.map +1 -1
  32. package/dist/src/func/builtins/aggregate.js +45 -67
  33. package/dist/src/func/builtins/aggregate.js.map +1 -1
  34. package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
  35. package/dist/src/func/builtins/builtin-window-functions.js +63 -48
  36. package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
  37. package/dist/src/func/builtins/scalar.d.ts.map +1 -1
  38. package/dist/src/func/builtins/scalar.js +92 -3
  39. package/dist/src/func/builtins/scalar.js.map +1 -1
  40. package/dist/src/func/registration.d.ts +18 -1
  41. package/dist/src/func/registration.d.ts.map +1 -1
  42. package/dist/src/func/registration.js +26 -0
  43. package/dist/src/func/registration.js.map +1 -1
  44. package/dist/src/index.d.ts +10 -10
  45. package/dist/src/index.d.ts.map +1 -1
  46. package/dist/src/index.js +13 -12
  47. package/dist/src/index.js.map +1 -1
  48. package/dist/src/parser/parser.d.ts +6 -0
  49. package/dist/src/parser/parser.d.ts.map +1 -1
  50. package/dist/src/parser/parser.js +45 -34
  51. package/dist/src/parser/parser.js.map +1 -1
  52. package/dist/src/planner/analysis/coarsened-key.d.ts +4 -3
  53. package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -1
  54. package/dist/src/planner/analysis/coarsened-key.js +37 -3
  55. package/dist/src/planner/analysis/coarsened-key.js.map +1 -1
  56. package/dist/src/planner/analysis/comparison-collation.d.ts +35 -3
  57. package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
  58. package/dist/src/planner/analysis/comparison-collation.js +37 -3
  59. package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
  60. package/dist/src/planner/analysis/coverage-prover.d.ts +13 -2
  61. package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
  62. package/dist/src/planner/analysis/coverage-prover.js +10 -14
  63. package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
  64. package/dist/src/planner/analysis/expression-fingerprint.d.ts.map +1 -1
  65. package/dist/src/planner/analysis/expression-fingerprint.js +29 -0
  66. package/dist/src/planner/analysis/expression-fingerprint.js.map +1 -1
  67. package/dist/src/planner/analysis/predicate-conjuncts.d.ts +10 -4
  68. package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -1
  69. package/dist/src/planner/analysis/predicate-conjuncts.js +28 -7
  70. package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -1
  71. package/dist/src/planner/analysis/query-rewrite-matcher.d.ts +6 -0
  72. package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
  73. package/dist/src/planner/analysis/query-rewrite-matcher.js +19 -29
  74. package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
  75. package/dist/src/planner/analysis/sat-checker.d.ts.map +1 -1
  76. package/dist/src/planner/analysis/sat-checker.js +43 -4
  77. package/dist/src/planner/analysis/sat-checker.js.map +1 -1
  78. package/dist/src/planner/analysis/scalar-subqueries.d.ts +22 -3
  79. package/dist/src/planner/analysis/scalar-subqueries.d.ts.map +1 -1
  80. package/dist/src/planner/analysis/scalar-subqueries.js +32 -3
  81. package/dist/src/planner/analysis/scalar-subqueries.js.map +1 -1
  82. package/dist/src/planner/analysis/set-op-type-merge.d.ts +64 -0
  83. package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -0
  84. package/dist/src/planner/analysis/set-op-type-merge.js +97 -0
  85. package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -0
  86. package/dist/src/planner/building/coercion.d.ts +78 -0
  87. package/dist/src/planner/building/coercion.d.ts.map +1 -0
  88. package/dist/src/planner/building/coercion.js +137 -0
  89. package/dist/src/planner/building/coercion.js.map +1 -0
  90. package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
  91. package/dist/src/planner/building/constraint-builder.js +5 -18
  92. package/dist/src/planner/building/constraint-builder.js.map +1 -1
  93. package/dist/src/planner/building/delete.d.ts.map +1 -1
  94. package/dist/src/planner/building/delete.js +10 -3
  95. package/dist/src/planner/building/delete.js.map +1 -1
  96. package/dist/src/planner/building/expression.d.ts.map +1 -1
  97. package/dist/src/planner/building/expression.js +13 -35
  98. package/dist/src/planner/building/expression.js.map +1 -1
  99. package/dist/src/planner/building/foreign-key-builder.d.ts +44 -1
  100. package/dist/src/planner/building/foreign-key-builder.d.ts.map +1 -1
  101. package/dist/src/planner/building/foreign-key-builder.js +54 -0
  102. package/dist/src/planner/building/foreign-key-builder.js.map +1 -1
  103. package/dist/src/planner/building/function-call.d.ts.map +1 -1
  104. package/dist/src/planner/building/function-call.js +8 -0
  105. package/dist/src/planner/building/function-call.js.map +1 -1
  106. package/dist/src/planner/building/insert.d.ts.map +1 -1
  107. package/dist/src/planner/building/insert.js +9 -12
  108. package/dist/src/planner/building/insert.js.map +1 -1
  109. package/dist/src/planner/building/select-compound.d.ts.map +1 -1
  110. package/dist/src/planner/building/select-compound.js +10 -6
  111. package/dist/src/planner/building/select-compound.js.map +1 -1
  112. package/dist/src/planner/building/update.d.ts.map +1 -1
  113. package/dist/src/planner/building/update.js +13 -4
  114. package/dist/src/planner/building/update.js.map +1 -1
  115. package/dist/src/planner/cost/conjunct-cost.d.ts +42 -0
  116. package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -0
  117. package/dist/src/planner/cost/conjunct-cost.js +62 -0
  118. package/dist/src/planner/cost/conjunct-cost.js.map +1 -0
  119. package/dist/src/planner/framework/pass.js +3 -3
  120. package/dist/src/planner/mutation/propagate.d.ts.map +1 -1
  121. package/dist/src/planner/mutation/propagate.js +1 -0
  122. package/dist/src/planner/mutation/propagate.js.map +1 -1
  123. package/dist/src/planner/nodes/async-gather-node.d.ts.map +1 -1
  124. package/dist/src/planner/nodes/async-gather-node.js +19 -8
  125. package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
  126. package/dist/src/planner/nodes/bloom-join-node.d.ts +2 -0
  127. package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
  128. package/dist/src/planner/nodes/bloom-join-node.js +10 -5
  129. package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
  130. package/dist/src/planner/nodes/dml-executor-node.d.ts +0 -9
  131. package/dist/src/planner/nodes/dml-executor-node.d.ts.map +1 -1
  132. package/dist/src/planner/nodes/dml-executor-node.js.map +1 -1
  133. package/dist/src/planner/nodes/join-node.d.ts +5 -0
  134. package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
  135. package/dist/src/planner/nodes/join-node.js +8 -1
  136. package/dist/src/planner/nodes/join-node.js.map +1 -1
  137. package/dist/src/planner/nodes/join-utils.d.ts +57 -0
  138. package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
  139. package/dist/src/planner/nodes/join-utils.js +47 -0
  140. package/dist/src/planner/nodes/join-utils.js.map +1 -1
  141. package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +87 -0
  142. package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -0
  143. package/dist/src/planner/nodes/key-set-semi-join-node.js +137 -0
  144. package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -0
  145. package/dist/src/planner/nodes/merge-join-node.d.ts +2 -0
  146. package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
  147. package/dist/src/planner/nodes/merge-join-node.js +14 -6
  148. package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
  149. package/dist/src/planner/nodes/plan-node-type.d.ts +1 -0
  150. package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
  151. package/dist/src/planner/nodes/plan-node-type.js +1 -0
  152. package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
  153. package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
  154. package/dist/src/planner/nodes/scalar.js +26 -3
  155. package/dist/src/planner/nodes/scalar.js.map +1 -1
  156. package/dist/src/planner/nodes/set-operation-node.d.ts +68 -16
  157. package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
  158. package/dist/src/planner/nodes/set-operation-node.js +147 -26
  159. package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
  160. package/dist/src/planner/nodes/table-access-nodes.d.ts +19 -1
  161. package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
  162. package/dist/src/planner/nodes/table-access-nodes.js +13 -2
  163. package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
  164. package/dist/src/planner/optimizer.d.ts.map +1 -1
  165. package/dist/src/planner/optimizer.js +54 -12
  166. package/dist/src/planner/optimizer.js.map +1 -1
  167. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +68 -0
  168. package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -0
  169. package/dist/src/planner/rules/access/rule-key-set-seek.js +408 -0
  170. package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -0
  171. package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
  172. package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
  173. package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
  174. package/dist/src/planner/rules/access/rule-select-access-path.d.ts +27 -0
  175. package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
  176. package/dist/src/planner/rules/access/rule-select-access-path.js +74 -29
  177. package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
  178. package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.d.ts.map +1 -1
  179. package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js +23 -4
  180. package/dist/src/planner/rules/cache/rule-materialized-view-rewrite.js.map +1 -1
  181. package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.d.ts +10 -8
  182. package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.d.ts.map +1 -1
  183. package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.js +10 -8
  184. package/dist/src/planner/rules/cache/rule-scalar-subquery-cache.js.map +1 -1
  185. package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +67 -41
  186. package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
  187. package/dist/src/planner/rules/join/equi-pair-extractor.js +72 -36
  188. package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
  189. package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
  190. package/dist/src/planner/rules/join/rule-join-physical-selection.js +14 -2
  191. package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
  192. package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
  193. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +11 -1
  194. package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
  195. package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +1 -1
  196. package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +1 -1
  197. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +30 -0
  198. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -0
  199. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +63 -0
  200. package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -0
  201. package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +17 -1
  202. package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
  203. package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +206 -12
  204. package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
  205. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +8 -1
  206. package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
  207. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts +3 -1
  208. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
  209. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +13 -1
  210. package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
  211. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
  212. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +18 -3
  213. package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
  214. package/dist/src/planner/rules/shared/index-style-context.d.ts +17 -0
  215. package/dist/src/planner/rules/shared/index-style-context.d.ts.map +1 -1
  216. package/dist/src/planner/rules/shared/index-style-context.js +7 -0
  217. package/dist/src/planner/rules/shared/index-style-context.js.map +1 -1
  218. package/dist/src/planner/rules/subquery/rule-scalar-agg-decorrelation.js +4 -0
  219. package/dist/src/planner/rules/subquery/rule-scalar-agg-decorrelation.js.map +1 -1
  220. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts +24 -6
  221. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
  222. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +175 -60
  223. package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
  224. package/dist/src/planner/stats/catalog-stats.d.ts +52 -0
  225. package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
  226. package/dist/src/planner/stats/catalog-stats.js +151 -5
  227. package/dist/src/planner/stats/catalog-stats.js.map +1 -1
  228. package/dist/src/planner/stats/index.d.ts +15 -0
  229. package/dist/src/planner/stats/index.d.ts.map +1 -1
  230. package/dist/src/planner/stats/index.js.map +1 -1
  231. package/dist/src/planner/stats/selectivity-combine.d.ts +53 -0
  232. package/dist/src/planner/stats/selectivity-combine.d.ts.map +1 -0
  233. package/dist/src/planner/stats/selectivity-combine.js +75 -0
  234. package/dist/src/planner/stats/selectivity-combine.js.map +1 -0
  235. package/dist/src/planner/util/column-origins.d.ts +58 -0
  236. package/dist/src/planner/util/column-origins.d.ts.map +1 -0
  237. package/dist/src/planner/util/column-origins.js +90 -0
  238. package/dist/src/planner/util/column-origins.js.map +1 -0
  239. package/dist/src/runtime/deferred-constraint-queue.d.ts +40 -0
  240. package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
  241. package/dist/src/runtime/deferred-constraint-queue.js +91 -0
  242. package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
  243. package/dist/src/runtime/emit/aggregate-setup.d.ts +49 -0
  244. package/dist/src/runtime/emit/aggregate-setup.d.ts.map +1 -0
  245. package/dist/src/runtime/emit/aggregate-setup.js +99 -0
  246. package/dist/src/runtime/emit/aggregate-setup.js.map +1 -0
  247. package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
  248. package/dist/src/runtime/emit/aggregate.js +4 -69
  249. package/dist/src/runtime/emit/aggregate.js.map +1 -1
  250. package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
  251. package/dist/src/runtime/emit/alter-table.js +354 -165
  252. package/dist/src/runtime/emit/alter-table.js.map +1 -1
  253. package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
  254. package/dist/src/runtime/emit/asof-scan.js +11 -0
  255. package/dist/src/runtime/emit/asof-scan.js.map +1 -1
  256. package/dist/src/runtime/emit/between.d.ts.map +1 -1
  257. package/dist/src/runtime/emit/between.js +7 -12
  258. package/dist/src/runtime/emit/between.js.map +1 -1
  259. package/dist/src/runtime/emit/binary.d.ts.map +1 -1
  260. package/dist/src/runtime/emit/binary.js +24 -25
  261. package/dist/src/runtime/emit/binary.js.map +1 -1
  262. package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
  263. package/dist/src/runtime/emit/bloom-join.js +8 -16
  264. package/dist/src/runtime/emit/bloom-join.js.map +1 -1
  265. package/dist/src/runtime/emit/case.d.ts.map +1 -1
  266. package/dist/src/runtime/emit/case.js +40 -6
  267. package/dist/src/runtime/emit/case.js.map +1 -1
  268. package/dist/src/runtime/emit/cast.d.ts.map +1 -1
  269. package/dist/src/runtime/emit/cast.js +10 -23
  270. package/dist/src/runtime/emit/cast.js.map +1 -1
  271. package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
  272. package/dist/src/runtime/emit/constraint-check.js +72 -51
  273. package/dist/src/runtime/emit/constraint-check.js.map +1 -1
  274. package/dist/src/runtime/emit/create-view.d.ts.map +1 -1
  275. package/dist/src/runtime/emit/create-view.js +6 -0
  276. package/dist/src/runtime/emit/create-view.js.map +1 -1
  277. package/dist/src/runtime/emit/distinct.d.ts.map +1 -1
  278. package/dist/src/runtime/emit/distinct.js +6 -3
  279. package/dist/src/runtime/emit/distinct.js.map +1 -1
  280. package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
  281. package/dist/src/runtime/emit/dml-executor.js +188 -84
  282. package/dist/src/runtime/emit/dml-executor.js.map +1 -1
  283. package/dist/src/runtime/emit/filter.d.ts +18 -0
  284. package/dist/src/runtime/emit/filter.d.ts.map +1 -1
  285. package/dist/src/runtime/emit/filter.js +52 -10
  286. package/dist/src/runtime/emit/filter.js.map +1 -1
  287. package/dist/src/runtime/emit/hash-aggregate.d.ts.map +1 -1
  288. package/dist/src/runtime/emit/hash-aggregate.js +16 -65
  289. package/dist/src/runtime/emit/hash-aggregate.js.map +1 -1
  290. package/dist/src/runtime/emit/insert.d.ts.map +1 -1
  291. package/dist/src/runtime/emit/insert.js +18 -7
  292. package/dist/src/runtime/emit/insert.js.map +1 -1
  293. package/dist/src/runtime/emit/join-key-extractor.d.ts +46 -0
  294. package/dist/src/runtime/emit/join-key-extractor.d.ts.map +1 -0
  295. package/dist/src/runtime/emit/join-key-extractor.js +60 -0
  296. package/dist/src/runtime/emit/join-key-extractor.js.map +1 -0
  297. package/dist/src/runtime/emit/join.d.ts.map +1 -1
  298. package/dist/src/runtime/emit/join.js +37 -11
  299. package/dist/src/runtime/emit/join.js.map +1 -1
  300. package/dist/src/runtime/emit/key-set-semi-join.d.ts +29 -0
  301. package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -0
  302. package/dist/src/runtime/emit/key-set-semi-join.js +143 -0
  303. package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -0
  304. package/dist/src/runtime/emit/materialized-view-helpers.d.ts +14 -1
  305. package/dist/src/runtime/emit/materialized-view-helpers.d.ts.map +1 -1
  306. package/dist/src/runtime/emit/materialized-view-helpers.js +33 -3
  307. package/dist/src/runtime/emit/materialized-view-helpers.js.map +1 -1
  308. package/dist/src/runtime/emit/materialized-view.d.ts.map +1 -1
  309. package/dist/src/runtime/emit/materialized-view.js +47 -6
  310. package/dist/src/runtime/emit/materialized-view.js.map +1 -1
  311. package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
  312. package/dist/src/runtime/emit/merge-join.js +32 -15
  313. package/dist/src/runtime/emit/merge-join.js.map +1 -1
  314. package/dist/src/runtime/emit/operand-comparator.d.ts +40 -0
  315. package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -0
  316. package/dist/src/runtime/emit/operand-comparator.js +59 -0
  317. package/dist/src/runtime/emit/operand-comparator.js.map +1 -0
  318. package/dist/src/runtime/emit/scan.d.ts.map +1 -1
  319. package/dist/src/runtime/emit/scan.js +11 -2
  320. package/dist/src/runtime/emit/scan.js.map +1 -1
  321. package/dist/src/runtime/emit/set-object-tags.d.ts +8 -0
  322. package/dist/src/runtime/emit/set-object-tags.d.ts.map +1 -1
  323. package/dist/src/runtime/emit/set-object-tags.js +8 -0
  324. package/dist/src/runtime/emit/set-object-tags.js.map +1 -1
  325. package/dist/src/runtime/emit/set-operation.d.ts.map +1 -1
  326. package/dist/src/runtime/emit/set-operation.js +7 -4
  327. package/dist/src/runtime/emit/set-operation.js.map +1 -1
  328. package/dist/src/runtime/emit/sort.d.ts.map +1 -1
  329. package/dist/src/runtime/emit/sort.js +5 -2
  330. package/dist/src/runtime/emit/sort.js.map +1 -1
  331. package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
  332. package/dist/src/runtime/emit/subquery.js +113 -13
  333. package/dist/src/runtime/emit/subquery.js.map +1 -1
  334. package/dist/src/runtime/emit/temporal-arithmetic.d.ts +7 -0
  335. package/dist/src/runtime/emit/temporal-arithmetic.d.ts.map +1 -1
  336. package/dist/src/runtime/emit/temporal-arithmetic.js +15 -7
  337. package/dist/src/runtime/emit/temporal-arithmetic.js.map +1 -1
  338. package/dist/src/runtime/emit/update.d.ts.map +1 -1
  339. package/dist/src/runtime/emit/update.js +44 -3
  340. package/dist/src/runtime/emit/update.js.map +1 -1
  341. package/dist/src/runtime/emit/window.d.ts.map +1 -1
  342. package/dist/src/runtime/emit/window.js +72 -55
  343. package/dist/src/runtime/emit/window.js.map +1 -1
  344. package/dist/src/runtime/foreign-key-actions.d.ts +36 -1
  345. package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
  346. package/dist/src/runtime/foreign-key-actions.js +238 -116
  347. package/dist/src/runtime/foreign-key-actions.js.map +1 -1
  348. package/dist/src/runtime/parallel-driver.d.ts +10 -2
  349. package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
  350. package/dist/src/runtime/parallel-driver.js +12 -2
  351. package/dist/src/runtime/parallel-driver.js.map +1 -1
  352. package/dist/src/runtime/register.d.ts.map +1 -1
  353. package/dist/src/runtime/register.js +2 -0
  354. package/dist/src/runtime/register.js.map +1 -1
  355. package/dist/src/runtime/types.d.ts +25 -0
  356. package/dist/src/runtime/types.d.ts.map +1 -1
  357. package/dist/src/runtime/types.js.map +1 -1
  358. package/dist/src/schema/catalog-persistability.d.ts +58 -0
  359. package/dist/src/schema/catalog-persistability.d.ts.map +1 -0
  360. package/dist/src/schema/catalog-persistability.js +87 -0
  361. package/dist/src/schema/catalog-persistability.js.map +1 -0
  362. package/dist/src/schema/catalog.d.ts +17 -1
  363. package/dist/src/schema/catalog.d.ts.map +1 -1
  364. package/dist/src/schema/catalog.js +25 -3
  365. package/dist/src/schema/catalog.js.map +1 -1
  366. package/dist/src/schema/constraint-builder.d.ts +20 -22
  367. package/dist/src/schema/constraint-builder.d.ts.map +1 -1
  368. package/dist/src/schema/constraint-builder.js +43 -36
  369. package/dist/src/schema/constraint-builder.js.map +1 -1
  370. package/dist/src/schema/ddl-generator.d.ts +23 -0
  371. package/dist/src/schema/ddl-generator.d.ts.map +1 -1
  372. package/dist/src/schema/ddl-generator.js +27 -0
  373. package/dist/src/schema/ddl-generator.js.map +1 -1
  374. package/dist/src/schema/function.d.ts +39 -1
  375. package/dist/src/schema/function.d.ts.map +1 -1
  376. package/dist/src/schema/function.js.map +1 -1
  377. package/dist/src/schema/manager.d.ts +28 -0
  378. package/dist/src/schema/manager.d.ts.map +1 -1
  379. package/dist/src/schema/manager.js +82 -14
  380. package/dist/src/schema/manager.js.map +1 -1
  381. package/dist/src/schema/schema-differ.d.ts.map +1 -1
  382. package/dist/src/schema/schema-differ.js +51 -12
  383. package/dist/src/schema/schema-differ.js.map +1 -1
  384. package/dist/src/schema/unique-enforcement.d.ts +31 -0
  385. package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
  386. package/dist/src/schema/unique-enforcement.js +37 -1
  387. package/dist/src/schema/unique-enforcement.js.map +1 -1
  388. package/dist/src/schema/window-function.d.ts +30 -10
  389. package/dist/src/schema/window-function.d.ts.map +1 -1
  390. package/dist/src/schema/window-function.js +20 -16
  391. package/dist/src/schema/window-function.js.map +1 -1
  392. package/dist/src/types/builtin-types.d.ts.map +1 -1
  393. package/dist/src/types/builtin-types.js +30 -4
  394. package/dist/src/types/builtin-types.js.map +1 -1
  395. package/dist/src/types/cast-semantics.d.ts +43 -0
  396. package/dist/src/types/cast-semantics.d.ts.map +1 -0
  397. package/dist/src/types/cast-semantics.js +59 -0
  398. package/dist/src/types/cast-semantics.js.map +1 -0
  399. package/dist/src/types/index.d.ts +1 -1
  400. package/dist/src/types/index.d.ts.map +1 -1
  401. package/dist/src/types/index.js +1 -1
  402. package/dist/src/types/index.js.map +1 -1
  403. package/dist/src/types/json-type.d.ts.map +1 -1
  404. package/dist/src/types/json-type.js +31 -10
  405. package/dist/src/types/json-type.js.map +1 -1
  406. package/dist/src/types/logical-type.d.ts +22 -0
  407. package/dist/src/types/logical-type.d.ts.map +1 -1
  408. package/dist/src/types/logical-type.js.map +1 -1
  409. package/dist/src/types/temporal-types.d.ts.map +1 -1
  410. package/dist/src/types/temporal-types.js +33 -11
  411. package/dist/src/types/temporal-types.js.map +1 -1
  412. package/dist/src/types/validation.d.ts +39 -1
  413. package/dist/src/types/validation.d.ts.map +1 -1
  414. package/dist/src/types/validation.js +60 -0
  415. package/dist/src/types/validation.js.map +1 -1
  416. package/dist/src/util/ast-spine-clone.d.ts +23 -0
  417. package/dist/src/util/ast-spine-clone.d.ts.map +1 -0
  418. package/dist/src/util/ast-spine-clone.js +41 -0
  419. package/dist/src/util/ast-spine-clone.js.map +1 -0
  420. package/dist/src/util/coercion.d.ts +13 -0
  421. package/dist/src/util/coercion.d.ts.map +1 -1
  422. package/dist/src/util/coercion.js +10 -1
  423. package/dist/src/util/coercion.js.map +1 -1
  424. package/dist/src/util/comparison.d.ts +114 -0
  425. package/dist/src/util/comparison.d.ts.map +1 -1
  426. package/dist/src/util/comparison.js +187 -27
  427. package/dist/src/util/comparison.js.map +1 -1
  428. package/dist/src/vtab/best-access-plan.d.ts +87 -0
  429. package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
  430. package/dist/src/vtab/best-access-plan.js +87 -0
  431. package/dist/src/vtab/best-access-plan.js.map +1 -1
  432. package/dist/src/vtab/manifest.d.ts +7 -0
  433. package/dist/src/vtab/manifest.d.ts.map +1 -1
  434. package/dist/src/vtab/memory/connection.d.ts +14 -1
  435. package/dist/src/vtab/memory/connection.d.ts.map +1 -1
  436. package/dist/src/vtab/memory/connection.js +20 -2
  437. package/dist/src/vtab/memory/connection.js.map +1 -1
  438. package/dist/src/vtab/memory/layer/base.d.ts +12 -5
  439. package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
  440. package/dist/src/vtab/memory/layer/base.js +20 -9
  441. package/dist/src/vtab/memory/layer/base.js.map +1 -1
  442. package/dist/src/vtab/memory/layer/connection.d.ts +17 -0
  443. package/dist/src/vtab/memory/layer/connection.d.ts.map +1 -1
  444. package/dist/src/vtab/memory/layer/connection.js +26 -0
  445. package/dist/src/vtab/memory/layer/connection.js.map +1 -1
  446. package/dist/src/vtab/memory/layer/manager.d.ts +156 -31
  447. package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
  448. package/dist/src/vtab/memory/layer/manager.js +695 -158
  449. package/dist/src/vtab/memory/layer/manager.js.map +1 -1
  450. package/dist/src/vtab/memory/layer/plan-filter.d.ts +41 -20
  451. package/dist/src/vtab/memory/layer/plan-filter.d.ts.map +1 -1
  452. package/dist/src/vtab/memory/layer/plan-filter.js +57 -27
  453. package/dist/src/vtab/memory/layer/plan-filter.js.map +1 -1
  454. package/dist/src/vtab/memory/layer/row-convert.d.ts +21 -0
  455. package/dist/src/vtab/memory/layer/row-convert.d.ts.map +1 -0
  456. package/dist/src/vtab/memory/layer/row-convert.js +30 -0
  457. package/dist/src/vtab/memory/layer/row-convert.js.map +1 -0
  458. package/dist/src/vtab/memory/layer/scan-layer.d.ts +6 -3
  459. package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
  460. package/dist/src/vtab/memory/layer/scan-layer.js +48 -34
  461. package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
  462. package/dist/src/vtab/memory/layer/transaction.d.ts +142 -19
  463. package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
  464. package/dist/src/vtab/memory/layer/transaction.js +237 -73
  465. package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
  466. package/dist/src/vtab/memory/module.d.ts +14 -2
  467. package/dist/src/vtab/memory/module.d.ts.map +1 -1
  468. package/dist/src/vtab/memory/module.js +60 -41
  469. package/dist/src/vtab/memory/module.js.map +1 -1
  470. package/dist/src/vtab/memory/table.d.ts +1 -1
  471. package/dist/src/vtab/memory/table.d.ts.map +1 -1
  472. package/dist/src/vtab/memory/table.js +12 -4
  473. package/dist/src/vtab/memory/table.js.map +1 -1
  474. package/dist/src/vtab/memory/types.d.ts +27 -1
  475. package/dist/src/vtab/memory/types.d.ts.map +1 -1
  476. package/dist/src/vtab/memory/types.js +16 -1
  477. package/dist/src/vtab/memory/types.js.map +1 -1
  478. package/dist/src/vtab/memory/utils/primary-key.d.ts +9 -0
  479. package/dist/src/vtab/memory/utils/primary-key.d.ts.map +1 -1
  480. package/dist/src/vtab/memory/utils/primary-key.js +11 -0
  481. package/dist/src/vtab/memory/utils/primary-key.js.map +1 -1
  482. package/dist/src/vtab/module.d.ts +63 -0
  483. package/dist/src/vtab/module.d.ts.map +1 -1
  484. package/dist/src/vtab/table.d.ts +33 -7
  485. package/dist/src/vtab/table.d.ts.map +1 -1
  486. package/dist/src/vtab/table.js.map +1 -1
  487. package/package.json +3 -3
  488. package/dist/src/planner/rules/cache/rule-in-subquery-cache.d.ts +0 -26
  489. package/dist/src/planner/rules/cache/rule-in-subquery-cache.d.ts.map +0 -1
  490. package/dist/src/planner/rules/cache/rule-in-subquery-cache.js +0 -66
  491. package/dist/src/planner/rules/cache/rule-in-subquery-cache.js.map +0 -1
@@ -4,6 +4,7 @@ import { createLogger } from '../../../common/logger.js';
4
4
  import { createPrimaryKeyFunctions } from '../utils/primary-key.js';
5
5
  import { QuereusError } from '../../../common/errors.js';
6
6
  import { StatusCode } from '../../../common/types.js';
7
+ import { convertRowAtIndex } from './row-convert.js';
7
8
  const log = createLogger('vtab:memory:layer:transaction');
8
9
  const warnLog = log.extend('warn');
9
10
  let transactionLayerCounter = 1000;
@@ -26,8 +27,10 @@ export class TransactionLayer {
26
27
  * Schema when this layer was started. Replaced when DDL runs inside this layer's own
27
28
  * transaction: by {@link adoptSchema} for additive index/constraint DDL, a secondary-index
28
29
  * re-key from `alter column … set collate`, and index/constraint removal (`drop index` /
29
- * `drop constraint`), and by {@link rekeyPrimaryKey} when that collate change lands on a
30
- * primary-key column. The column set is identical across every such swap.
30
+ * `drop constraint`); by {@link rekeyPrimaryKey} when that collate change lands on a
31
+ * primary-key column; and by {@link installReshapedColumns} when `add column` / `drop
32
+ * column` changes the column set itself. Every swap except the last keeps the column set
33
+ * identical.
31
34
  */
32
35
  tableSchemaAtCreation;
33
36
  /**
@@ -104,12 +107,17 @@ export class TransactionLayer {
104
107
  * `IndexSchema` (so an index scan raises "Secondary index not found") nor the derived
105
108
  * `uniqueConstraints` entry (so `checkUniqueConstraints` silently skips it and a
106
109
  * colliding insert is accepted).
107
- * - **Re-keying** (`alter column … set collate`): an index whose `IndexSchema` object
108
- * is no longer the one this layer holds is REPLACED. `BaseLayer.rebuildAllSecondaryIndexes`
109
- * hands every index a fresh BTree under the new collation, so a layer that kept its old
110
- * `MemoryIndex` would go on comparing under the old collation over an orphaned tree —
111
- * and, once it becomes the committed head at commit, would shadow the base's rebuilt
112
- * structures entirely.
110
+ * - **Re-keying** (`alter column … set collate`, or an `alter column … set data type` that
111
+ * keeps the physical storage class but moves to a differently-ordering logical type —
112
+ * text timespan, where 'PT1H' and 'PT60M' are one value): an index whose `IndexSchema`
113
+ * object is no longer the one this layer holds is REPLACED.
114
+ * `BaseLayer.rebuildAllSecondaryIndexes` hands every index a fresh BTree under the new
115
+ * comparator, so a layer that kept its old `MemoryIndex` would go on comparing the old way
116
+ * over an orphaned tree — and, once it becomes the committed head at commit, would shadow
117
+ * the base's rebuilt structures entirely. The retype has no index-column field to change
118
+ * (an index column carries no logical type; it reads the column's), so
119
+ * `MemoryTableManager.alterColumn` rebuilds the `IndexSchema` objects purely to raise this
120
+ * signal — see its `structuresRekeyed` branch.
113
121
  * - **Removal** (`drop index` / `drop constraint`): an index whose name the new schema no
114
122
  * longer declares is DROPPED from {@link secondaryIndexes}. Without it the layer keeps the
115
123
  * derived `uniqueConstraints` entry in its frozen schema and goes on enforcing a constraint
@@ -130,8 +138,10 @@ export class TransactionLayer {
130
138
  *
131
139
  * Never applied to a column-set or primary-key change: either would invalidate
132
140
  * {@link pkFunctions} and the primary tree. A PK-column collation change goes to
133
- * {@link rekeyPrimaryKey} instead, and `ensureSchemaChangeSafety` raises BUSY when any
134
- * connection other than the DDL issuer holds a pending layer.
141
+ * {@link rekeyPrimaryKey} instead, a column-set change (`add column` / `drop column`) to
142
+ * {@link prepareReshapedColumns} / {@link installReshapedColumns}, and
143
+ * `ensureSchemaChangeSafety` raises BUSY when any connection other than the DDL issuer
144
+ * holds a pending layer.
135
145
  */
136
146
  adoptSchema(newSchema) {
137
147
  const oldSchema = this.tableSchemaAtCreation;
@@ -186,21 +196,26 @@ export class TransactionLayer {
186
196
  * in the parent, so a deletion removes exactly the row this layer removed and an upsert
187
197
  * lands at exactly one key.
188
198
  *
189
- * NOTE: the deletion replay assumes a key this layer deleted was a key the PARENT held.
190
- * That holds because every DML operation gets its own layer (`MemoryTableConnection`'s
191
- * statement savepoints), so no layer both creates and destroys a key. If a single layer
192
- * ever does, `rekeyed.find(key)` can land on a *colliding* parent row and delete it: at
193
- * that point the deletion needs to verify, under the OLD comparator, that the row it found
194
- * is the row it removed.
199
+ * The deletion replay verifies, under the OLD comparator, that the row it finds is the row
200
+ * it removed (see {@link installNetOwnWrites}'s `deletionTargets`). Without that check a
201
+ * deletion whose old key collapses onto a DIFFERENT row's new key deletes that other row:
202
+ * stage an upsert at key `'a'` in one layer, delete the colliding `'A'` from a LATER layer,
203
+ * and the later layer's replayed deletion lands on the parent's `'a'` silently removing
204
+ * the row the transaction just wrote. `validateRekeyedPrimaryKey`'s chain walk refuses any
205
+ * chain that holds a colliding pair before this method runs, which makes a cross-row land
206
+ * unreachable today — the verify is insurance, so the replay's own correctness does not
207
+ * hinge on that caller-side pass staying exactly as conservative as it is.
195
208
  */
196
209
  rekeyPrimaryKey(newSchema) {
210
+ // The pending-change EVENT log is deliberately NOT rewritten here: a collation
211
+ // change moves only the comparator — every stored value and every key value is
212
+ // untouched — so the recorded `pk`/`oldRow`/`newRow` images stay accurate as-is.
213
+ // (Contrast convertColumn / installReshapedColumns, which do rewrite the log.)
197
214
  const preRekeyTree = this.primaryModifications;
198
- const preRekeyEncode = this.pkFunctions.encode;
215
+ const preRekeyFunctions = this.pkFunctions;
216
+ const preRekeyEncode = preRekeyFunctions.encode;
199
217
  this.tableSchemaAtCreation = newSchema;
200
218
  this.pkFunctions = createPrimaryKeyFunctions(newSchema, this.collationResolver);
201
- const { extractFromRow, compare } = this.pkFunctions;
202
- const parentPrimaryTree = this.parentLayer.getModificationTree('primary');
203
- const rekeyed = new BTree((value) => extractFromRow(value), compare, { base: parentPrimaryTree || undefined });
204
219
  // Net per-key effect of this layer's own writes, read out of the pre-rekey tree
205
220
  // (`get` traverses the inheritance chain, so it yields the layer's EFFECTIVE row).
206
221
  const deletions = [];
@@ -217,29 +232,66 @@ export class TransactionLayer {
217
232
  else
218
233
  upserts.push(effectiveRow);
219
234
  }
235
+ // Only the re-key can make a deletion's find() land on a colliding OTHER row, so only
236
+ // this caller passes the old-comparator identity check (see the method doc above).
237
+ this.installNetOwnWrites(deletions, upserts, (deletionKey, foundRow) => preRekeyFunctions.compare(deletionKey, preRekeyFunctions.extractFromRow(foundRow)) === 0);
238
+ }
239
+ /**
240
+ * A fresh primary tree inheriting copy-on-write from the parent's CURRENT one, keyed by this
241
+ * layer's current {@link pkFunctions}. Callers must have installed the post-DDL `pkFunctions`
242
+ * first, and the parent must already carry the DDL (every whole-layer rebuild runs oldest-first).
243
+ */
244
+ newPrimaryTreeOverParent() {
245
+ const { extractFromRow, compare } = this.pkFunctions;
246
+ return new BTree((value) => extractFromRow(value), compare, { base: this.parentLayer.getModificationTree('primary') || undefined });
247
+ }
248
+ /**
249
+ * Shared tail of the three whole-layer rebuilds — {@link rekeyPrimaryKey},
250
+ * {@link convertColumn}, {@link installReshapedColumns}. Each has already swapped in its new
251
+ * schema (and, where the key changed, its new {@link pkFunctions}) and collapsed
252
+ * {@link ownWrites} to the net per-key effect passed here; this replays that effect into a
253
+ * tree built over the parent's fresh one, installs it, rewrites the own-write log to match,
254
+ * and rebuilds every secondary index.
255
+ *
256
+ * Every index is rebuilt unconditionally, not only those over an altered column: each inherits
257
+ * the parent's freshly-rebuilt tree, and each index's key encoding and PK bookkeeping derive
258
+ * from `pkFunctions`.
259
+ *
260
+ * A deletion an upsert has since re-occupied is dropped from the log — keeping it would make
261
+ * the log claim both a deletion and an upsert of the same key. Only {@link rekeyPrimaryKey}
262
+ * can produce that collision (two old keys collapsing under the new comparator); where key
263
+ * values are invariant a key is classified as either a deletion or an upsert, never both, so
264
+ * the filter is a no-op.
265
+ *
266
+ * `deletionTargets` guards each deletion's replay: `find(key)` runs under the NEW comparator,
267
+ * so a re-key can land it on a colliding row this layer never removed — a row a PARENT layer
268
+ * upserted at what is now the same key. Only {@link rekeyPrimaryKey} passes it (an
269
+ * old-comparator identity check); the column-set/value rebuilds leave key values untouched,
270
+ * where find() can only land on the deleted key itself.
271
+ */
272
+ installNetOwnWrites(deletions, upserts, deletionTargets) {
273
+ const rebuilt = this.newPrimaryTreeOverParent();
220
274
  for (const primaryKey of deletions) {
221
- const path = rekeyed.find(primaryKey);
222
- if (path.on)
223
- rekeyed.deleteAt(path);
275
+ const path = rebuilt.find(primaryKey);
276
+ if (!path.on)
277
+ continue;
278
+ if (deletionTargets && !deletionTargets(primaryKey, rebuilt.at(path)))
279
+ continue;
280
+ rebuilt.deleteAt(path);
224
281
  }
225
282
  for (const row of upserts) {
226
- rekeyed.upsert(row);
283
+ rebuilt.upsert(row);
227
284
  }
228
- this.primaryModifications = rekeyed;
229
- // A deleted key an upsert has since re-occupied (`update t set v='A' where v='a'` under
230
- // NOCASE) is no longer a deletion of anything: keeping it would make the log claim both
231
- // a deletion and an upsert of the same key.
232
- const survivingDeletions = deletions.filter(primaryKey => rekeyed.get(primaryKey) === undefined);
285
+ this.primaryModifications = rebuilt;
286
+ const { extractFromRow } = this.pkFunctions;
233
287
  this.ownWrites.length = 0;
234
- for (const primaryKey of survivingDeletions) {
235
- this.ownWrites.push({ type: 'delete', primaryKey });
288
+ for (const primaryKey of deletions) {
289
+ if (rebuilt.get(primaryKey) === undefined)
290
+ this.ownWrites.push({ type: 'delete', primaryKey });
236
291
  }
237
292
  for (const row of upserts) {
238
293
  this.ownWrites.push({ type: 'upsert', primaryKey: extractFromRow(row), newRow: row });
239
294
  }
240
- // Every secondary index's key encoding and PK bookkeeping derive from `pkFunctions`,
241
- // and each inherits the parent's freshly-rebuilt tree — so all of them are rebuilt,
242
- // including ones the altered column does not appear in.
243
295
  this.secondaryIndexes = new Map();
244
296
  this.initializeSecondaryIndexes();
245
297
  for (const index of this.secondaryIndexes.values()) {
@@ -255,11 +307,16 @@ export class TransactionLayer {
255
307
  * layer, not the base.
256
308
  *
257
309
  * NON-primary-key column, or a key column whose bytes are unchanged. `MemoryTableManager.alterColumn`
258
- * rejects a physical retype of a key column before any mutation, and SET NOT NULL leaves the key
310
+ * rejects any retype of a key column before any mutation, and SET NOT NULL leaves the key
259
311
  * bytes intact, so the primary key encoding is unchanged: {@link pkFunctions} and the primary tree
260
312
  * keep their keys, and only the value at `colIndex` moves. (Contrast {@link rekeyPrimaryKey}, which
261
313
  * must rebuild the tree because the keys themselves change.)
262
314
  *
315
+ * Subsumes {@link adoptSchema} for a same-storage-class retype that ALSO moves the comparator
316
+ * (text → date/timespan): `tableSchemaAtCreation` is swapped to `newSchema` and every secondary
317
+ * index is rebuilt from scratch against it below, so the layer's structures pick up the new
318
+ * comparators along with the converted values.
319
+ *
263
320
  * Like {@link adoptSchema} / {@link rekeyPrimaryKey}, the caller MUST apply this oldest-first
264
321
  * (base already converted): the layer's copy-on-write base inherits the parent's already-converted
265
322
  * rows, so only this layer's OWN writes are rewritten here.
@@ -280,15 +337,12 @@ export class TransactionLayer {
280
337
  this.tableSchemaAtCreation = newSchema;
281
338
  // The parent's primary tree has been REPLACED by the conversion (base rebuilt from fresh
282
339
  // rows, or a parent layer already converted oldest-first), so this layer's own tree — which
283
- // derived from the OLD one — must be rebuilt over the parent's NEW tree, exactly as
284
- // rekeyPrimaryKey does. The PK is unchanged (a key-column retype is rejected upstream), so
285
- // pkFunctions and the keys stay; only the value at colIndex moves.
286
- const { extractFromRow, compare } = this.pkFunctions;
287
- const parentPrimaryTree = this.parentLayer.getModificationTree('primary');
288
- const rebuilt = new BTree((value) => extractFromRow(value), compare, { base: parentPrimaryTree || undefined });
289
- // Net per-key effect of this layer's own writes, read out of the pre-conversion tree. The PK
290
- // is unchanged, so a key is either finally-deleted or finally-upserted, never both — no key
291
- // can collapse onto another (unlike rekeyPrimaryKey).
340
+ // derived from the OLD one — must be rebuilt over the parent's NEW tree; installNetOwnWrites
341
+ // below does that. The PK is unchanged (a key-column retype is rejected upstream), so
342
+ // pkFunctions and the keys stay; only the value at colIndex moves — which also means a key
343
+ // is either finally-deleted or finally-upserted, never both, and no key can collapse onto
344
+ // another (unlike rekeyPrimaryKey). The net per-key effect is read out of the
345
+ // pre-conversion tree.
292
346
  const seen = new Set();
293
347
  const survivingDeletions = [];
294
348
  const upserts = [];
@@ -304,42 +358,139 @@ export class TransactionLayer {
304
358
  survivingDeletions.push(write.primaryKey);
305
359
  continue;
306
360
  }
307
- const oldVal = effectiveRow[colIndex];
308
361
  let newRow = effectiveRow;
309
- if (oldVal !== null || convertNulls) {
310
- try {
311
- const newVal = convert(oldVal);
312
- newRow = effectiveRow.map((v, i) => i === colIndex ? newVal : v);
313
- }
314
- catch {
315
- // Shadowed unconvertible own value — leave as-is (see method doc).
316
- }
362
+ try {
363
+ newRow = convertRowAtIndex(effectiveRow, colIndex, convert, convertNulls);
364
+ }
365
+ catch {
366
+ // Shadowed unconvertible own value — leave as-is (see method doc).
317
367
  }
318
368
  upserts.push(newRow);
319
369
  }
320
- for (const primaryKey of survivingDeletions) {
321
- const path = rebuilt.find(primaryKey);
322
- if (path.on)
323
- rebuilt.deleteAt(path);
324
- }
325
- for (const row of upserts) {
326
- rebuilt.upsert(row);
370
+ this.installNetOwnWrites(survivingDeletions, upserts);
371
+ // Rewrite the pending-change EVENT log's images too, so the events emitted at this
372
+ // table's commit carry the post-conversion values the committed rows hold. Best-effort,
373
+ // per image: the log holds historical images (including superseded intermediate ones the
374
+ // net rewrite above never touches), so an unconvertible value keeps its raw form rather
375
+ // than failing the ALTER. One entry per recorded write is kept — no dedup, unlike the
376
+ // own-write collapse — because every recorded write is a separately delivered event.
377
+ if (this.pendingChanges) {
378
+ this.pendingChanges = this.pendingChanges.map(change => {
379
+ const remapImage = (row) => {
380
+ if (!row)
381
+ return row;
382
+ try {
383
+ return convertRowAtIndex(row, colIndex, convert, convertNulls);
384
+ }
385
+ catch {
386
+ return row;
387
+ }
388
+ };
389
+ return { ...change, oldRow: remapImage(change.oldRow), newRow: remapImage(change.newRow) };
390
+ });
327
391
  }
328
- this.primaryModifications = rebuilt;
329
- this.ownWrites.length = 0;
330
- for (const primaryKey of survivingDeletions) {
331
- this.ownWrites.push({ type: 'delete', primaryKey });
392
+ }
393
+ /**
394
+ * Computes without mutating anything — what {@link installReshapedColumns} will install
395
+ * for an `alter table … add column` / `drop column` applied while THIS layer's transaction
396
+ * is still open: the net per-key effect of the layer's own writes, with each surviving row
397
+ * run through `reshapeRow` to the new column set.
398
+ *
399
+ * Split from the install (unlike {@link convertColumn}, which mutates in one pass) because
400
+ * this rewrite can FAIL: an ADD COLUMN with a per-row `default (new.<col>)` expression
401
+ * evaluates that expression against each pending row, and it can throw — or produce NULL
402
+ * for a NOT NULL column — on a pending row even when every committed row backfilled cleanly.
403
+ * The rewrite is async for the same reason (`convertColumn`'s value map is a pure function;
404
+ * a backfill evaluator is engine-supplied and may await). `MemoryTableManager` therefore runs
405
+ * every prepare — one per open layer — BEFORE the first mutation anywhere (base included), so
406
+ * a failure rejects the whole ALTER with every structure untouched; there is no undo for a
407
+ * half-reshaped layer chain.
408
+ *
409
+ * Own writes collapse to one entry per key exactly as {@link convertColumn}'s pass does: a
410
+ * column-set change leaves every primary key VALUE untouched (ADD introduces a column no key
411
+ * reads — even when it is inserted ahead of one, which only renumbers the key's *indices*;
412
+ * dropping a PK column is rejected upstream), so a key is either finally-deleted or
413
+ * finally-upserted, never both, and no key can collapse onto another.
414
+ */
415
+ async prepareReshapedColumns(reshapeRow, reshapeEventRow) {
416
+ const seen = new Set();
417
+ const survivingDeletions = [];
418
+ const upserts = [];
419
+ for (const write of this.ownWrites) {
420
+ const encoded = this.pkFunctions.encode(write.primaryKey);
421
+ if (seen.has(encoded))
422
+ continue;
423
+ seen.add(encoded);
424
+ // `get` traverses the inheritance chain, so this is the layer's EFFECTIVE row:
425
+ // undefined when the layer deleted the key, the layer's own row otherwise.
426
+ const effectiveRow = this.primaryModifications.get(write.primaryKey);
427
+ if (effectiveRow === undefined) {
428
+ survivingDeletions.push(write.primaryKey);
429
+ continue;
430
+ }
431
+ upserts.push(await reshapeRow(effectiveRow));
332
432
  }
333
- for (const row of upserts) {
334
- this.ownWrites.push({ type: 'upsert', primaryKey: extractFromRow(row), newRow: row });
433
+ // Reshape the pending-change EVENT log alongside — through `reshapeEventRow`, the
434
+ // BEST-EFFORT variant of `reshapeRow`, deliberately the opposite posture: `reshapeRow`
435
+ // rewrites the layer's net effective rows and its failure MUST reject the ALTER, while
436
+ // the log holds historical images (including superseded intermediate ones the net
437
+ // rewrite never touches) that a backfill evaluator can legitimately fail on. The
438
+ // caller supplies a `reshapeEventRow` that falls back rather than throws (ADD COLUMN
439
+ // fills NULL when the evaluator fails); a throw that still escapes leaves that image
440
+ // at the old arity (logged) and never rejects the ALTER. One entry per recorded write
441
+ // is kept — no dedup, unlike the own-write collapse above — because every recorded
442
+ // write is a separately delivered event.
443
+ let reshapedPendingChanges = null;
444
+ if (this.pendingChanges) {
445
+ reshapedPendingChanges = [];
446
+ for (const change of this.pendingChanges) {
447
+ const next = { ...change };
448
+ try {
449
+ if (change.oldRow)
450
+ next.oldRow = await reshapeEventRow(change.oldRow);
451
+ if (change.newRow)
452
+ next.newRow = await reshapeEventRow(change.newRow);
453
+ }
454
+ catch (e) {
455
+ warnLog('Pending-change reshape failed on %s; leaving image at the old arity: %O', this.tableSchemaAtCreation.name, e);
456
+ }
457
+ reshapedPendingChanges.push(next);
458
+ }
335
459
  }
336
- // Any secondary index on the column holds keys extracted from the OLD value. Rebuild every
337
- // index over the parent's freshly-converted trees (matching the base's unconditional rebuild),
338
- // then re-file this layer's own converted writes.
339
- this.secondaryIndexes = new Map();
340
- this.initializeSecondaryIndexes();
341
- for (const index of this.secondaryIndexes.values()) {
342
- this.reindexOwnWrites(index);
460
+ return { survivingDeletions, upserts, reshapedPendingChanges };
461
+ }
462
+ /**
463
+ * Adopts an `alter table … add column` / `drop column` applied while THIS layer's
464
+ * transaction is still open, installing what {@link prepareReshapedColumns} computed:
465
+ * swaps in the new schema, rebuilds the primary tree over the parent's already-reshaped
466
+ * one, replays the layer's net own-writes at the new arity, and rebuilds every secondary
467
+ * index. Synchronous and mutation-only — everything fallible ran in the prepare phase.
468
+ *
469
+ * {@link pkFunctions} is REBUILT (unlike {@link convertColumn}, which keeps it): a column-set
470
+ * change can shift the primary key's column *indices* — DROP COLUMN renumbers
471
+ * `primaryKeyDefinition` past the dropped slot, and an ADD COLUMN placed AHEAD of a key
472
+ * column (`insertAtIndex`, module-API only) renumbers it past the inserted slot — so the row
473
+ * extractor changes even though the key *values* do not. Because the values are invariant
474
+ * under both ADD (the new column is not part of any key, wherever it lands) and DROP
475
+ * (dropping a PK column is rejected upstream), tree ordering is preserved and the
476
+ * `primaryKey` values recorded in {@link ownWrites} stay valid — no re-key of the kind
477
+ * {@link rekeyPrimaryKey} performs is needed, and the prepared deletions apply verbatim.
478
+ *
479
+ * Like every other open-layer adoption, the caller MUST apply this to the whole parent
480
+ * chain oldest-first (base already reshaped): the rebuilt tree inherits copy-on-write from
481
+ * the parent's NEW tree, so the parent's must already hold rows at the new arity. The
482
+ * rewritten {@link ownWrites} log — carrying reshaped rows — is what the commit-time rebase
483
+ * and any later `create index` ({@link reindexOwnWrites}) replay.
484
+ */
485
+ installReshapedColumns(newSchema, prepared) {
486
+ this.tableSchemaAtCreation = newSchema;
487
+ this.pkFunctions = createPrimaryKeyFunctions(newSchema, this.collationResolver);
488
+ this.installNetOwnWrites(prepared.survivingDeletions, prepared.upserts);
489
+ // Install the reshaped event log the prepare phase computed (null ⇔ tracking
490
+ // disabled), so the events emitted at this table's commit describe rows in the
491
+ // post-ALTER column set.
492
+ if (prepared.reshapedPendingChanges !== null) {
493
+ this.pendingChanges = prepared.reshapedPendingChanges;
343
494
  }
344
495
  }
345
496
  /**
@@ -414,6 +565,19 @@ export class TransactionLayer {
414
565
  getPendingChanges() {
415
566
  return this.pendingChanges ?? [];
416
567
  }
568
+ /**
569
+ * Drops the pending-change event log (tracking stays enabled). Called when this
570
+ * layer's content is drained into the base by ALTER's consolidation
571
+ * (`MemoryTableManager.consolidateToBaseLayer`): its events were already delivered
572
+ * when the layer originally committed, but the layer can remain in the DDL
573
+ * connection's open-transaction parent chain — and once the base becomes the
574
+ * committed head, the commit-time collection (`collectPendingChanges`) walks that
575
+ * chain all the way down to the base and would re-deliver them.
576
+ */
577
+ clearPendingChanges() {
578
+ if (this.pendingChanges)
579
+ this.pendingChanges = [];
580
+ }
417
581
  /** This layer's own structural writes, oldest-first — the rebase replay source. */
418
582
  getOwnWrites() {
419
583
  return this.ownWrites;
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../../src/vtab/memory/layer/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAA4B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,MAAM,GAAG,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAC1D,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEnC,IAAI,uBAAuB,GAAG,IAAI,CAAC;AA0BnC;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IACX,OAAO,CAAS;IACjB,WAAW,CAAQ;IACnC;;;;;OAKG;IACa,iBAAiB,CAAoB;IACrD;;;;;;OAMG;IACK,qBAAqB,CAAc;IAE3C;;;;;OAKG;IACK,WAAW,CAAsB;IAEzC,wDAAwD;IA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AAI,EAAE,QAAQ;gBACd,EAAE,EAAE,UAAU;gBACd,MAAM,EAAE,oBAAoB;aAC5B,CAAC,CAAC;QACJ,CAAC;QAED,oFAAoF;QACpF,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAChC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAChE,IAAI,CAAC,WAAW;oBAAE,SAAS;gBAE3B,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;oBAAE,SAAS;gBAErE,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;gBACjE,WAAW,CAAC,WAAW,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;IAEM,UAAU;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;QACtC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1D,WAAW,CAAC,SAAS,EAAE,CAAC;QACzB,CAAC;IACF,CAAC;CACD"}
@@ -101,8 +101,20 @@ export declare class MemoryTableModule implements VirtualTableModule<MemoryTable
101
101
  private evaluateIndexAccess;
102
102
  /**
103
103
  * Find equality matches for index columns (prefix matching).
104
- * Handles `=`, single-value `IN`, and multi-value `IN` as equality constraints.
105
- * Returns the total cardinality (product of IN list sizes) for cost estimation.
104
+ * Handles `=`, single-value `IN`, multi-value `IN`, and a runtime-valued `IN` set as
105
+ * equality constraints {@link equalitySeekKeyCount} is the single well-formedness
106
+ * test, so the four cannot drift apart. Returns the total cardinality (the product of
107
+ * the per-column seek-key counts) for cost estimation; for a runtime set that count is
108
+ * its `maxCount` ceiling, the worst case the engine may deliver.
109
+ *
110
+ * Claims the FIRST role-filling filter per column, matching the positional pick
111
+ * `rule-select-access-path` makes — so a request carrying both a runtime set and a
112
+ * literal `IN` on one column seeks whichever came first in `filters` order, and the
113
+ * other survives as a residual.
114
+ *
115
+ * `isMultiSeek` is NOT `inCardinality > 1`: a runtime set is delivered as a multi-seek
116
+ * whatever its ceiling, so a `maxCount === 1` set has cardinality 1 yet still walks the
117
+ * index in seek-key order. {@link isMultiValueEquality} is the authority.
106
118
  */
107
119
  private findEqualityMatches;
108
120
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../src/vtab/memory/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAqB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,oBAAoB,CAAC;AAI3G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAqC,MAAM,wBAAwB,CAAC;AAC7H,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,M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