drizzle-orm 1.0.0-beta.21 → 1.0.0-beta.21-4fa69ab

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 (1591) hide show
  1. package/_relations.cjs.map +1 -1
  2. package/_relations.d.cts +2 -13
  3. package/_relations.d.ts +2 -13
  4. package/_relations.js.map +1 -1
  5. package/aws-data-api/common/index.cjs +2 -0
  6. package/aws-data-api/common/index.cjs.map +1 -1
  7. package/aws-data-api/common/index.js +2 -0
  8. package/aws-data-api/common/index.js.map +1 -1
  9. package/aws-data-api/pg/driver.cjs +93 -20
  10. package/aws-data-api/pg/driver.cjs.map +1 -1
  11. package/aws-data-api/pg/driver.d.cts +17 -13
  12. package/aws-data-api/pg/driver.d.ts +16 -12
  13. package/aws-data-api/pg/driver.js +93 -20
  14. package/aws-data-api/pg/driver.js.map +1 -1
  15. package/aws-data-api/pg/index.cjs +1 -1
  16. package/aws-data-api/pg/index.d.cts +3 -3
  17. package/aws-data-api/pg/index.d.ts +3 -3
  18. package/aws-data-api/pg/index.js +3 -3
  19. package/aws-data-api/pg/migrator.cjs.map +1 -1
  20. package/aws-data-api/pg/migrator.d.cts +1 -1
  21. package/aws-data-api/pg/migrator.d.ts +1 -1
  22. package/aws-data-api/pg/migrator.js.map +1 -1
  23. package/aws-data-api/pg/session.cjs +44 -113
  24. package/aws-data-api/pg/session.cjs.map +1 -1
  25. package/aws-data-api/pg/session.d.cts +12 -42
  26. package/aws-data-api/pg/session.d.ts +12 -42
  27. package/aws-data-api/pg/session.js +46 -114
  28. package/aws-data-api/pg/session.js.map +1 -1
  29. package/better-sqlite3/driver.cjs +5 -2
  30. package/better-sqlite3/driver.cjs.map +1 -1
  31. package/better-sqlite3/driver.d.ts +1 -1
  32. package/better-sqlite3/driver.js +5 -2
  33. package/better-sqlite3/driver.js.map +1 -1
  34. package/better-sqlite3/session.cjs +15 -14
  35. package/better-sqlite3/session.cjs.map +1 -1
  36. package/better-sqlite3/session.d.cts +10 -6
  37. package/better-sqlite3/session.d.ts +10 -6
  38. package/better-sqlite3/session.js +16 -15
  39. package/better-sqlite3/session.js.map +1 -1
  40. package/bun-sql/driver.cjs.map +1 -1
  41. package/bun-sql/driver.d.cts +7 -6
  42. package/bun-sql/driver.d.ts +7 -6
  43. package/bun-sql/driver.js.map +1 -1
  44. package/bun-sql/index.cjs +0 -1
  45. package/bun-sql/index.d.cts +2 -2
  46. package/bun-sql/index.d.ts +2 -2
  47. package/bun-sql/index.js +2 -2
  48. package/bun-sql/migrator.cjs.map +1 -1
  49. package/bun-sql/migrator.d.cts +2 -2
  50. package/bun-sql/migrator.d.ts +2 -2
  51. package/bun-sql/migrator.js.map +1 -1
  52. package/bun-sql/mysql/driver.cjs +4 -3
  53. package/bun-sql/mysql/driver.cjs.map +1 -1
  54. package/bun-sql/mysql/driver.js +3 -2
  55. package/bun-sql/mysql/driver.js.map +1 -1
  56. package/bun-sql/mysql/session.cjs +36 -23
  57. package/bun-sql/mysql/session.cjs.map +1 -1
  58. package/bun-sql/mysql/session.d.cts +10 -4
  59. package/bun-sql/mysql/session.d.ts +11 -5
  60. package/bun-sql/mysql/session.js +37 -24
  61. package/bun-sql/mysql/session.js.map +1 -1
  62. package/bun-sql/postgres/driver.cjs +143 -19
  63. package/bun-sql/postgres/driver.cjs.map +1 -1
  64. package/bun-sql/postgres/driver.d.cts +10 -6
  65. package/bun-sql/postgres/driver.d.ts +10 -6
  66. package/bun-sql/postgres/driver.js +143 -19
  67. package/bun-sql/postgres/driver.js.map +1 -1
  68. package/bun-sql/postgres/index.cjs +1 -1
  69. package/bun-sql/postgres/index.d.cts +3 -3
  70. package/bun-sql/postgres/index.d.ts +3 -3
  71. package/bun-sql/postgres/index.js +3 -3
  72. package/bun-sql/postgres/migrator.cjs.map +1 -1
  73. package/bun-sql/postgres/migrator.d.cts +1 -1
  74. package/bun-sql/postgres/migrator.d.ts +1 -1
  75. package/bun-sql/postgres/migrator.js.map +1 -1
  76. package/bun-sql/postgres/session.cjs +16 -111
  77. package/bun-sql/postgres/session.cjs.map +1 -1
  78. package/bun-sql/postgres/session.d.cts +11 -33
  79. package/bun-sql/postgres/session.d.ts +10 -32
  80. package/bun-sql/postgres/session.js +17 -111
  81. package/bun-sql/postgres/session.js.map +1 -1
  82. package/bun-sql/session.cjs +0 -1
  83. package/bun-sql/session.d.cts +2 -2
  84. package/bun-sql/session.d.ts +2 -2
  85. package/bun-sql/session.js +2 -2
  86. package/bun-sql/sqlite/driver.cjs +4 -3
  87. package/bun-sql/sqlite/driver.cjs.map +1 -1
  88. package/bun-sql/sqlite/driver.d.ts +1 -1
  89. package/bun-sql/sqlite/driver.js +3 -2
  90. package/bun-sql/sqlite/driver.js.map +1 -1
  91. package/bun-sql/sqlite/session.cjs +17 -16
  92. package/bun-sql/sqlite/session.cjs.map +1 -1
  93. package/bun-sql/sqlite/session.d.cts +9 -6
  94. package/bun-sql/sqlite/session.d.ts +9 -6
  95. package/bun-sql/sqlite/session.js +18 -17
  96. package/bun-sql/sqlite/session.js.map +1 -1
  97. package/bun-sqlite/driver.cjs +5 -2
  98. package/bun-sqlite/driver.cjs.map +1 -1
  99. package/bun-sqlite/driver.d.ts +1 -1
  100. package/bun-sqlite/driver.js +5 -2
  101. package/bun-sqlite/driver.js.map +1 -1
  102. package/bun-sqlite/session.cjs +15 -14
  103. package/bun-sqlite/session.cjs.map +1 -1
  104. package/bun-sqlite/session.d.cts +10 -6
  105. package/bun-sqlite/session.d.ts +10 -6
  106. package/bun-sqlite/session.js +16 -15
  107. package/bun-sqlite/session.js.map +1 -1
  108. package/cache/core/cache-effect.d.cts +1 -1
  109. package/cache/core/cache-effect.d.ts +1 -1
  110. package/cache/upstash/cache.d.cts +1 -1
  111. package/cache/upstash/cache.d.ts +1 -1
  112. package/cockroach/driver.cjs +9 -3
  113. package/cockroach/driver.cjs.map +1 -1
  114. package/cockroach/driver.d.cts +1 -0
  115. package/cockroach/driver.d.ts +2 -1
  116. package/cockroach/driver.js +9 -3
  117. package/cockroach/driver.js.map +1 -1
  118. package/cockroach/session.cjs +7 -9
  119. package/cockroach/session.cjs.map +1 -1
  120. package/cockroach/session.d.cts +5 -3
  121. package/cockroach/session.d.ts +6 -4
  122. package/cockroach/session.js +8 -10
  123. package/cockroach/session.js.map +1 -1
  124. package/cockroach-core/columns/bigint.cjs +4 -4
  125. package/cockroach-core/columns/bigint.cjs.map +1 -1
  126. package/cockroach-core/columns/bigint.d.cts +2 -2
  127. package/cockroach-core/columns/bigint.d.ts +2 -2
  128. package/cockroach-core/columns/bigint.js +4 -4
  129. package/cockroach-core/columns/bigint.js.map +1 -1
  130. package/cockroach-core/columns/common.cjs +4 -4
  131. package/cockroach-core/columns/common.cjs.map +1 -1
  132. package/cockroach-core/columns/common.d.cts +2 -2
  133. package/cockroach-core/columns/common.d.ts +2 -2
  134. package/cockroach-core/columns/common.js +4 -4
  135. package/cockroach-core/columns/common.js.map +1 -1
  136. package/cockroach-core/columns/custom.cjs +4 -4
  137. package/cockroach-core/columns/custom.cjs.map +1 -1
  138. package/cockroach-core/columns/custom.d.cts +2 -2
  139. package/cockroach-core/columns/custom.d.ts +2 -2
  140. package/cockroach-core/columns/custom.js +4 -4
  141. package/cockroach-core/columns/custom.js.map +1 -1
  142. package/cockroach-core/columns/date.cjs +6 -6
  143. package/cockroach-core/columns/date.cjs.map +1 -1
  144. package/cockroach-core/columns/date.d.cts +3 -3
  145. package/cockroach-core/columns/date.d.ts +3 -3
  146. package/cockroach-core/columns/date.js +6 -6
  147. package/cockroach-core/columns/date.js.map +1 -1
  148. package/cockroach-core/columns/decimal.cjs +4 -4
  149. package/cockroach-core/columns/decimal.cjs.map +1 -1
  150. package/cockroach-core/columns/decimal.d.cts +2 -2
  151. package/cockroach-core/columns/decimal.d.ts +2 -2
  152. package/cockroach-core/columns/decimal.js +4 -4
  153. package/cockroach-core/columns/decimal.js.map +1 -1
  154. package/cockroach-core/columns/float.cjs +2 -2
  155. package/cockroach-core/columns/float.cjs.map +1 -1
  156. package/cockroach-core/columns/float.d.cts +1 -1
  157. package/cockroach-core/columns/float.d.ts +1 -1
  158. package/cockroach-core/columns/float.js +2 -2
  159. package/cockroach-core/columns/float.js.map +1 -1
  160. package/cockroach-core/columns/geometry.cjs +8 -8
  161. package/cockroach-core/columns/geometry.cjs.map +1 -1
  162. package/cockroach-core/columns/geometry.d.cts +5 -5
  163. package/cockroach-core/columns/geometry.d.ts +5 -5
  164. package/cockroach-core/columns/geometry.js +8 -8
  165. package/cockroach-core/columns/geometry.js.map +1 -1
  166. package/cockroach-core/columns/integer.cjs +2 -2
  167. package/cockroach-core/columns/integer.cjs.map +1 -1
  168. package/cockroach-core/columns/integer.d.cts +1 -1
  169. package/cockroach-core/columns/integer.d.ts +1 -1
  170. package/cockroach-core/columns/integer.js +2 -2
  171. package/cockroach-core/columns/integer.js.map +1 -1
  172. package/cockroach-core/columns/jsonb.cjs +4 -4
  173. package/cockroach-core/columns/jsonb.cjs.map +1 -1
  174. package/cockroach-core/columns/jsonb.d.cts +2 -2
  175. package/cockroach-core/columns/jsonb.d.ts +2 -2
  176. package/cockroach-core/columns/jsonb.js +4 -4
  177. package/cockroach-core/columns/jsonb.js.map +1 -1
  178. package/cockroach-core/columns/vector.cjs +4 -4
  179. package/cockroach-core/columns/vector.cjs.map +1 -1
  180. package/cockroach-core/columns/vector.d.cts +2 -2
  181. package/cockroach-core/columns/vector.d.ts +2 -2
  182. package/cockroach-core/columns/vector.js +4 -4
  183. package/cockroach-core/columns/vector.js.map +1 -1
  184. package/cockroach-core/db.cjs +1 -1
  185. package/cockroach-core/db.cjs.map +1 -1
  186. package/cockroach-core/db.js +1 -1
  187. package/cockroach-core/db.js.map +1 -1
  188. package/cockroach-core/dialect.cjs +1 -1
  189. package/cockroach-core/dialect.d.ts +1 -1
  190. package/cockroach-core/dialect.js +1 -1
  191. package/cockroach-core/query-builders/delete.cjs +6 -2
  192. package/cockroach-core/query-builders/delete.cjs.map +1 -1
  193. package/cockroach-core/query-builders/delete.d.cts +1 -1
  194. package/cockroach-core/query-builders/delete.d.ts +1 -1
  195. package/cockroach-core/query-builders/delete.js +6 -2
  196. package/cockroach-core/query-builders/delete.js.map +1 -1
  197. package/cockroach-core/query-builders/insert.cjs +6 -2
  198. package/cockroach-core/query-builders/insert.cjs.map +1 -1
  199. package/cockroach-core/query-builders/insert.js +6 -2
  200. package/cockroach-core/query-builders/insert.js.map +1 -1
  201. package/cockroach-core/query-builders/query.cjs +2 -2
  202. package/cockroach-core/query-builders/query.cjs.map +1 -1
  203. package/cockroach-core/query-builders/query.js +2 -2
  204. package/cockroach-core/query-builders/query.js.map +1 -1
  205. package/cockroach-core/query-builders/raw.cjs +0 -4
  206. package/cockroach-core/query-builders/raw.cjs.map +1 -1
  207. package/cockroach-core/query-builders/raw.js +0 -4
  208. package/cockroach-core/query-builders/raw.js.map +1 -1
  209. package/cockroach-core/query-builders/refresh-materialized-view.cjs +2 -2
  210. package/cockroach-core/query-builders/refresh-materialized-view.cjs.map +1 -1
  211. package/cockroach-core/query-builders/refresh-materialized-view.js +2 -2
  212. package/cockroach-core/query-builders/refresh-materialized-view.js.map +1 -1
  213. package/cockroach-core/query-builders/select.cjs +6 -2
  214. package/cockroach-core/query-builders/select.cjs.map +1 -1
  215. package/cockroach-core/query-builders/select.js +6 -2
  216. package/cockroach-core/query-builders/select.js.map +1 -1
  217. package/cockroach-core/query-builders/update.cjs +6 -2
  218. package/cockroach-core/query-builders/update.cjs.map +1 -1
  219. package/cockroach-core/query-builders/update.js +6 -2
  220. package/cockroach-core/query-builders/update.js.map +1 -1
  221. package/cockroach-core/session.cjs +2 -2
  222. package/cockroach-core/session.cjs.map +1 -1
  223. package/cockroach-core/session.d.cts +1 -1
  224. package/cockroach-core/session.d.ts +1 -1
  225. package/cockroach-core/session.js +2 -2
  226. package/cockroach-core/session.js.map +1 -1
  227. package/cockroach-core/table.cjs +1 -1
  228. package/cockroach-core/table.cjs.map +1 -1
  229. package/cockroach-core/table.js +1 -1
  230. package/cockroach-core/table.js.map +1 -1
  231. package/codecs.cjs +77 -0
  232. package/codecs.cjs.map +1 -0
  233. package/codecs.d.cts +68 -0
  234. package/codecs.d.ts +68 -0
  235. package/codecs.js +74 -0
  236. package/codecs.js.map +1 -0
  237. package/column.cjs +10 -5
  238. package/column.cjs.map +1 -1
  239. package/column.d.cts +3 -3
  240. package/column.d.ts +3 -3
  241. package/column.js +10 -5
  242. package/column.js.map +1 -1
  243. package/d1/driver.cjs +3 -2
  244. package/d1/driver.cjs.map +1 -1
  245. package/d1/driver.d.ts +1 -1
  246. package/d1/driver.js +3 -2
  247. package/d1/driver.js.map +1 -1
  248. package/d1/session.cjs +16 -14
  249. package/d1/session.cjs.map +1 -1
  250. package/d1/session.d.cts +9 -6
  251. package/d1/session.d.ts +9 -6
  252. package/d1/session.js +17 -15
  253. package/d1/session.js.map +1 -1
  254. package/durable-sqlite/driver.cjs +5 -2
  255. package/durable-sqlite/driver.cjs.map +1 -1
  256. package/durable-sqlite/driver.d.ts +1 -1
  257. package/durable-sqlite/driver.js +5 -2
  258. package/durable-sqlite/driver.js.map +1 -1
  259. package/durable-sqlite/session.cjs +15 -14
  260. package/durable-sqlite/session.cjs.map +1 -1
  261. package/durable-sqlite/session.d.cts +10 -6
  262. package/durable-sqlite/session.d.ts +10 -6
  263. package/durable-sqlite/session.js +16 -15
  264. package/durable-sqlite/session.js.map +1 -1
  265. package/effect-postgres/driver.cjs +99 -13
  266. package/effect-postgres/driver.cjs.map +1 -1
  267. package/effect-postgres/driver.d.cts +12 -8
  268. package/effect-postgres/driver.d.ts +12 -8
  269. package/effect-postgres/driver.js +99 -13
  270. package/effect-postgres/driver.js.map +1 -1
  271. package/effect-postgres/index.cjs +1 -1
  272. package/effect-postgres/index.d.cts +3 -3
  273. package/effect-postgres/index.d.ts +3 -3
  274. package/effect-postgres/index.js +3 -3
  275. package/effect-postgres/migrator.cjs.map +1 -1
  276. package/effect-postgres/migrator.d.cts +1 -1
  277. package/effect-postgres/migrator.d.ts +1 -1
  278. package/effect-postgres/migrator.js.map +1 -1
  279. package/effect-postgres/session.cjs +12 -71
  280. package/effect-postgres/session.cjs.map +1 -1
  281. package/effect-postgres/session.d.cts +14 -31
  282. package/effect-postgres/session.d.ts +16 -33
  283. package/effect-postgres/session.js +13 -71
  284. package/effect-postgres/session.js.map +1 -1
  285. package/expo-sqlite/driver.cjs +5 -2
  286. package/expo-sqlite/driver.cjs.map +1 -1
  287. package/expo-sqlite/driver.d.ts +1 -1
  288. package/expo-sqlite/driver.js +5 -2
  289. package/expo-sqlite/driver.js.map +1 -1
  290. package/expo-sqlite/session.cjs +15 -14
  291. package/expo-sqlite/session.cjs.map +1 -1
  292. package/expo-sqlite/session.d.cts +10 -6
  293. package/expo-sqlite/session.d.ts +10 -6
  294. package/expo-sqlite/session.js +16 -15
  295. package/expo-sqlite/session.js.map +1 -1
  296. package/gel/driver.cjs +4 -2
  297. package/gel/driver.cjs.map +1 -1
  298. package/gel/driver.d.cts +1 -0
  299. package/gel/driver.d.ts +2 -1
  300. package/gel/driver.js +4 -2
  301. package/gel/driver.js.map +1 -1
  302. package/gel/session.cjs +12 -12
  303. package/gel/session.cjs.map +1 -1
  304. package/gel/session.d.cts +8 -5
  305. package/gel/session.d.ts +9 -6
  306. package/gel/session.js +13 -13
  307. package/gel/session.js.map +1 -1
  308. package/gel-core/columns/bigintT.cjs +2 -2
  309. package/gel-core/columns/bigintT.cjs.map +1 -1
  310. package/gel-core/columns/bigintT.d.cts +1 -1
  311. package/gel-core/columns/bigintT.d.ts +1 -1
  312. package/gel-core/columns/bigintT.js +2 -2
  313. package/gel-core/columns/bigintT.js.map +1 -1
  314. package/gel-core/columns/common.cjs +2 -2
  315. package/gel-core/columns/common.cjs.map +1 -1
  316. package/gel-core/columns/common.d.cts +1 -1
  317. package/gel-core/columns/common.d.ts +1 -1
  318. package/gel-core/columns/common.js +2 -2
  319. package/gel-core/columns/common.js.map +1 -1
  320. package/gel-core/columns/custom.cjs +4 -4
  321. package/gel-core/columns/custom.cjs.map +1 -1
  322. package/gel-core/columns/custom.d.cts +2 -2
  323. package/gel-core/columns/custom.d.ts +2 -2
  324. package/gel-core/columns/custom.js +4 -4
  325. package/gel-core/columns/custom.js.map +1 -1
  326. package/gel-core/columns/double-precision.cjs +2 -2
  327. package/gel-core/columns/double-precision.cjs.map +1 -1
  328. package/gel-core/columns/double-precision.d.cts +1 -1
  329. package/gel-core/columns/double-precision.d.ts +1 -1
  330. package/gel-core/columns/double-precision.js +2 -2
  331. package/gel-core/columns/double-precision.js.map +1 -1
  332. package/gel-core/columns/timestamptz.cjs +2 -2
  333. package/gel-core/columns/timestamptz.cjs.map +1 -1
  334. package/gel-core/columns/timestamptz.d.cts +1 -1
  335. package/gel-core/columns/timestamptz.d.ts +1 -1
  336. package/gel-core/columns/timestamptz.js +2 -2
  337. package/gel-core/columns/timestamptz.js.map +1 -1
  338. package/gel-core/db.cjs +1 -1
  339. package/gel-core/db.cjs.map +1 -1
  340. package/gel-core/db.d.ts +1 -1
  341. package/gel-core/db.js +1 -1
  342. package/gel-core/db.js.map +1 -1
  343. package/gel-core/query-builders/_query.cjs +2 -2
  344. package/gel-core/query-builders/_query.cjs.map +1 -1
  345. package/gel-core/query-builders/_query.js +2 -2
  346. package/gel-core/query-builders/_query.js.map +1 -1
  347. package/gel-core/query-builders/delete.cjs +2 -2
  348. package/gel-core/query-builders/delete.cjs.map +1 -1
  349. package/gel-core/query-builders/delete.js +2 -2
  350. package/gel-core/query-builders/delete.js.map +1 -1
  351. package/gel-core/query-builders/insert.cjs +2 -2
  352. package/gel-core/query-builders/insert.cjs.map +1 -1
  353. package/gel-core/query-builders/insert.js +2 -2
  354. package/gel-core/query-builders/insert.js.map +1 -1
  355. package/gel-core/query-builders/query.cjs +13 -5
  356. package/gel-core/query-builders/query.cjs.map +1 -1
  357. package/gel-core/query-builders/query.d.ts +1 -1
  358. package/gel-core/query-builders/query.js +14 -6
  359. package/gel-core/query-builders/query.js.map +1 -1
  360. package/gel-core/query-builders/raw.cjs +0 -4
  361. package/gel-core/query-builders/raw.cjs.map +1 -1
  362. package/gel-core/query-builders/raw.js +0 -4
  363. package/gel-core/query-builders/raw.js.map +1 -1
  364. package/gel-core/query-builders/refresh-materialized-view.cjs +2 -2
  365. package/gel-core/query-builders/refresh-materialized-view.cjs.map +1 -1
  366. package/gel-core/query-builders/refresh-materialized-view.js +2 -2
  367. package/gel-core/query-builders/refresh-materialized-view.js.map +1 -1
  368. package/gel-core/query-builders/select.cjs +6 -2
  369. package/gel-core/query-builders/select.cjs.map +1 -1
  370. package/gel-core/query-builders/select.js +6 -2
  371. package/gel-core/query-builders/select.js.map +1 -1
  372. package/gel-core/query-builders/update.cjs +2 -2
  373. package/gel-core/query-builders/update.cjs.map +1 -1
  374. package/gel-core/query-builders/update.js +2 -2
  375. package/gel-core/query-builders/update.js.map +1 -1
  376. package/gel-core/session.cjs +2 -2
  377. package/gel-core/session.cjs.map +1 -1
  378. package/gel-core/session.d.cts +3 -3
  379. package/gel-core/session.d.ts +3 -3
  380. package/gel-core/session.js +2 -2
  381. package/gel-core/session.js.map +1 -1
  382. package/gel-core/table.cjs +1 -1
  383. package/gel-core/table.cjs.map +1 -1
  384. package/gel-core/table.js +1 -1
  385. package/gel-core/table.js.map +1 -1
  386. package/index.cjs +6 -0
  387. package/index.d.cts +6 -6
  388. package/index.d.ts +6 -6
  389. package/index.js +4 -4
  390. package/libsql/driver-core.cjs +3 -2
  391. package/libsql/driver-core.cjs.map +1 -1
  392. package/libsql/driver-core.d.ts +1 -1
  393. package/libsql/driver-core.js +3 -2
  394. package/libsql/driver-core.js.map +1 -1
  395. package/libsql/session.cjs +13 -14
  396. package/libsql/session.cjs.map +1 -1
  397. package/libsql/session.d.cts +9 -6
  398. package/libsql/session.d.ts +9 -6
  399. package/libsql/session.js +14 -15
  400. package/libsql/session.js.map +1 -1
  401. package/mssql-core/columns/bigint.cjs +2 -2
  402. package/mssql-core/columns/bigint.cjs.map +1 -1
  403. package/mssql-core/columns/bigint.d.cts +1 -1
  404. package/mssql-core/columns/bigint.d.ts +1 -1
  405. package/mssql-core/columns/bigint.js +2 -2
  406. package/mssql-core/columns/bigint.js.map +1 -1
  407. package/mssql-core/columns/custom.cjs +4 -4
  408. package/mssql-core/columns/custom.cjs.map +1 -1
  409. package/mssql-core/columns/custom.d.cts +2 -2
  410. package/mssql-core/columns/custom.d.ts +2 -2
  411. package/mssql-core/columns/custom.js +4 -4
  412. package/mssql-core/columns/custom.js.map +1 -1
  413. package/mssql-core/columns/date.cjs +4 -4
  414. package/mssql-core/columns/date.cjs.map +1 -1
  415. package/mssql-core/columns/date.d.cts +2 -2
  416. package/mssql-core/columns/date.d.ts +2 -2
  417. package/mssql-core/columns/date.js +4 -4
  418. package/mssql-core/columns/date.js.map +1 -1
  419. package/mssql-core/columns/datetime.cjs +2 -2
  420. package/mssql-core/columns/datetime.cjs.map +1 -1
  421. package/mssql-core/columns/datetime.d.cts +1 -1
  422. package/mssql-core/columns/datetime.d.ts +1 -1
  423. package/mssql-core/columns/datetime.js +2 -2
  424. package/mssql-core/columns/datetime.js.map +1 -1
  425. package/mssql-core/columns/datetime2.cjs +2 -2
  426. package/mssql-core/columns/datetime2.cjs.map +1 -1
  427. package/mssql-core/columns/datetime2.d.cts +1 -1
  428. package/mssql-core/columns/datetime2.d.ts +1 -1
  429. package/mssql-core/columns/datetime2.js +2 -2
  430. package/mssql-core/columns/datetime2.js.map +1 -1
  431. package/mssql-core/columns/datetimeoffset.cjs +2 -2
  432. package/mssql-core/columns/datetimeoffset.cjs.map +1 -1
  433. package/mssql-core/columns/datetimeoffset.d.cts +1 -1
  434. package/mssql-core/columns/datetimeoffset.d.ts +1 -1
  435. package/mssql-core/columns/datetimeoffset.js +2 -2
  436. package/mssql-core/columns/datetimeoffset.js.map +1 -1
  437. package/mssql-core/columns/decimal.cjs +4 -4
  438. package/mssql-core/columns/decimal.cjs.map +1 -1
  439. package/mssql-core/columns/decimal.d.cts +2 -2
  440. package/mssql-core/columns/decimal.d.ts +2 -2
  441. package/mssql-core/columns/decimal.js +4 -4
  442. package/mssql-core/columns/decimal.js.map +1 -1
  443. package/mssql-core/columns/numeric.cjs +4 -4
  444. package/mssql-core/columns/numeric.cjs.map +1 -1
  445. package/mssql-core/columns/numeric.d.cts +2 -2
  446. package/mssql-core/columns/numeric.d.ts +2 -2
  447. package/mssql-core/columns/numeric.js +4 -4
  448. package/mssql-core/columns/numeric.js.map +1 -1
  449. package/mssql-core/columns/smallint.cjs +2 -2
  450. package/mssql-core/columns/smallint.cjs.map +1 -1
  451. package/mssql-core/columns/smallint.d.cts +1 -1
  452. package/mssql-core/columns/smallint.d.ts +1 -1
  453. package/mssql-core/columns/smallint.js +2 -2
  454. package/mssql-core/columns/smallint.js.map +1 -1
  455. package/mssql-core/columns/time.cjs +2 -2
  456. package/mssql-core/columns/time.cjs.map +1 -1
  457. package/mssql-core/columns/time.d.cts +1 -1
  458. package/mssql-core/columns/time.d.ts +1 -1
  459. package/mssql-core/columns/time.js +2 -2
  460. package/mssql-core/columns/time.js.map +1 -1
  461. package/mssql-core/columns/tinyint.cjs +2 -2
  462. package/mssql-core/columns/tinyint.cjs.map +1 -1
  463. package/mssql-core/columns/tinyint.d.cts +1 -1
  464. package/mssql-core/columns/tinyint.d.ts +1 -1
  465. package/mssql-core/columns/tinyint.js +2 -2
  466. package/mssql-core/columns/tinyint.js.map +1 -1
  467. package/mssql-core/columns/varchar.cjs +4 -4
  468. package/mssql-core/columns/varchar.cjs.map +1 -1
  469. package/mssql-core/columns/varchar.d.cts +2 -2
  470. package/mssql-core/columns/varchar.d.ts +2 -2
  471. package/mssql-core/columns/varchar.js +4 -4
  472. package/mssql-core/columns/varchar.js.map +1 -1
  473. package/mssql-core/dialect.cjs +1 -1
  474. package/mssql-core/dialect.d.ts +1 -1
  475. package/mssql-core/dialect.js +1 -1
  476. package/mssql-core/query-builders/select.cjs +4 -0
  477. package/mssql-core/query-builders/select.cjs.map +1 -1
  478. package/mssql-core/query-builders/select.js +4 -0
  479. package/mssql-core/query-builders/select.js.map +1 -1
  480. package/mssql-core/query-builders/update.d.ts +1 -1
  481. package/mssql-core/table.cjs +1 -1
  482. package/mssql-core/table.cjs.map +1 -1
  483. package/mssql-core/table.js +1 -1
  484. package/mssql-core/table.js.map +1 -1
  485. package/mysql-core/columns/bigint.cjs +8 -8
  486. package/mysql-core/columns/bigint.cjs.map +1 -1
  487. package/mysql-core/columns/bigint.d.cts +4 -4
  488. package/mysql-core/columns/bigint.d.ts +4 -4
  489. package/mysql-core/columns/bigint.js +8 -8
  490. package/mysql-core/columns/bigint.js.map +1 -1
  491. package/mysql-core/columns/binary.cjs +2 -2
  492. package/mysql-core/columns/binary.cjs.map +1 -1
  493. package/mysql-core/columns/binary.d.cts +1 -1
  494. package/mysql-core/columns/binary.d.ts +1 -1
  495. package/mysql-core/columns/binary.js +2 -2
  496. package/mysql-core/columns/binary.js.map +1 -1
  497. package/mysql-core/columns/blob.cjs +4 -4
  498. package/mysql-core/columns/blob.cjs.map +1 -1
  499. package/mysql-core/columns/blob.d.cts +2 -2
  500. package/mysql-core/columns/blob.d.ts +2 -2
  501. package/mysql-core/columns/blob.js +4 -4
  502. package/mysql-core/columns/blob.js.map +1 -1
  503. package/mysql-core/columns/boolean.cjs +2 -2
  504. package/mysql-core/columns/boolean.cjs.map +1 -1
  505. package/mysql-core/columns/boolean.d.cts +1 -1
  506. package/mysql-core/columns/boolean.d.ts +1 -1
  507. package/mysql-core/columns/boolean.js +2 -2
  508. package/mysql-core/columns/boolean.js.map +1 -1
  509. package/mysql-core/columns/custom.cjs +4 -4
  510. package/mysql-core/columns/custom.cjs.map +1 -1
  511. package/mysql-core/columns/custom.d.cts +2 -2
  512. package/mysql-core/columns/custom.d.ts +2 -2
  513. package/mysql-core/columns/custom.js +4 -4
  514. package/mysql-core/columns/custom.js.map +1 -1
  515. package/mysql-core/columns/date.cjs +4 -4
  516. package/mysql-core/columns/date.cjs.map +1 -1
  517. package/mysql-core/columns/date.d.cts +2 -2
  518. package/mysql-core/columns/date.d.ts +2 -2
  519. package/mysql-core/columns/date.js +4 -4
  520. package/mysql-core/columns/date.js.map +1 -1
  521. package/mysql-core/columns/datetime.cjs +8 -8
  522. package/mysql-core/columns/datetime.cjs.map +1 -1
  523. package/mysql-core/columns/datetime.d.cts +4 -4
  524. package/mysql-core/columns/datetime.d.ts +4 -4
  525. package/mysql-core/columns/datetime.js +8 -8
  526. package/mysql-core/columns/datetime.js.map +1 -1
  527. package/mysql-core/columns/decimal.cjs +4 -4
  528. package/mysql-core/columns/decimal.cjs.map +1 -1
  529. package/mysql-core/columns/decimal.d.cts +2 -2
  530. package/mysql-core/columns/decimal.d.ts +2 -2
  531. package/mysql-core/columns/decimal.js +4 -4
  532. package/mysql-core/columns/decimal.js.map +1 -1
  533. package/mysql-core/columns/float.cjs +2 -2
  534. package/mysql-core/columns/float.cjs.map +1 -1
  535. package/mysql-core/columns/float.d.cts +1 -1
  536. package/mysql-core/columns/float.d.ts +1 -1
  537. package/mysql-core/columns/float.js +2 -2
  538. package/mysql-core/columns/float.js.map +1 -1
  539. package/mysql-core/columns/int.cjs +2 -2
  540. package/mysql-core/columns/int.cjs.map +1 -1
  541. package/mysql-core/columns/int.d.cts +1 -1
  542. package/mysql-core/columns/int.d.ts +1 -1
  543. package/mysql-core/columns/int.js +2 -2
  544. package/mysql-core/columns/int.js.map +1 -1
  545. package/mysql-core/columns/json.cjs +2 -2
  546. package/mysql-core/columns/json.cjs.map +1 -1
  547. package/mysql-core/columns/json.d.cts +1 -1
  548. package/mysql-core/columns/json.d.ts +1 -1
  549. package/mysql-core/columns/json.js +2 -2
  550. package/mysql-core/columns/json.js.map +1 -1
  551. package/mysql-core/columns/mediumint.cjs +2 -2
  552. package/mysql-core/columns/mediumint.cjs.map +1 -1
  553. package/mysql-core/columns/mediumint.d.cts +1 -1
  554. package/mysql-core/columns/mediumint.d.ts +1 -1
  555. package/mysql-core/columns/mediumint.js +2 -2
  556. package/mysql-core/columns/mediumint.js.map +1 -1
  557. package/mysql-core/columns/serial.cjs +2 -2
  558. package/mysql-core/columns/serial.cjs.map +1 -1
  559. package/mysql-core/columns/serial.d.cts +1 -1
  560. package/mysql-core/columns/serial.d.ts +1 -1
  561. package/mysql-core/columns/serial.js +2 -2
  562. package/mysql-core/columns/serial.js.map +1 -1
  563. package/mysql-core/columns/smallint.cjs +2 -2
  564. package/mysql-core/columns/smallint.cjs.map +1 -1
  565. package/mysql-core/columns/smallint.d.cts +1 -1
  566. package/mysql-core/columns/smallint.d.ts +1 -1
  567. package/mysql-core/columns/smallint.js +2 -2
  568. package/mysql-core/columns/smallint.js.map +1 -1
  569. package/mysql-core/columns/time.cjs +2 -2
  570. package/mysql-core/columns/time.cjs.map +1 -1
  571. package/mysql-core/columns/time.d.cts +1 -1
  572. package/mysql-core/columns/time.d.ts +1 -1
  573. package/mysql-core/columns/time.js +2 -2
  574. package/mysql-core/columns/time.js.map +1 -1
  575. package/mysql-core/columns/timestamp.cjs +8 -8
  576. package/mysql-core/columns/timestamp.cjs.map +1 -1
  577. package/mysql-core/columns/timestamp.d.cts +4 -4
  578. package/mysql-core/columns/timestamp.d.ts +4 -4
  579. package/mysql-core/columns/timestamp.js +8 -8
  580. package/mysql-core/columns/timestamp.js.map +1 -1
  581. package/mysql-core/columns/tinyint.cjs +2 -2
  582. package/mysql-core/columns/tinyint.cjs.map +1 -1
  583. package/mysql-core/columns/tinyint.d.cts +1 -1
  584. package/mysql-core/columns/tinyint.d.ts +1 -1
  585. package/mysql-core/columns/tinyint.js +2 -2
  586. package/mysql-core/columns/tinyint.js.map +1 -1
  587. package/mysql-core/columns/varbinary.cjs +2 -2
  588. package/mysql-core/columns/varbinary.cjs.map +1 -1
  589. package/mysql-core/columns/varbinary.d.cts +1 -1
  590. package/mysql-core/columns/varbinary.d.ts +1 -1
  591. package/mysql-core/columns/varbinary.js +2 -2
  592. package/mysql-core/columns/varbinary.js.map +1 -1
  593. package/mysql-core/columns/year.cjs +2 -2
  594. package/mysql-core/columns/year.cjs.map +1 -1
  595. package/mysql-core/columns/year.d.cts +1 -1
  596. package/mysql-core/columns/year.d.ts +1 -1
  597. package/mysql-core/columns/year.js +2 -2
  598. package/mysql-core/columns/year.js.map +1 -1
  599. package/mysql-core/db.d.ts +1 -1
  600. package/mysql-core/dialect.cjs +1 -1
  601. package/mysql-core/dialect.d.ts +1 -1
  602. package/mysql-core/dialect.js +1 -1
  603. package/mysql-core/query-builders/query.cjs +13 -5
  604. package/mysql-core/query-builders/query.cjs.map +1 -1
  605. package/mysql-core/query-builders/query.d.ts +1 -1
  606. package/mysql-core/query-builders/query.js +13 -5
  607. package/mysql-core/query-builders/query.js.map +1 -1
  608. package/mysql-core/query-builders/select.cjs +4 -0
  609. package/mysql-core/query-builders/select.cjs.map +1 -1
  610. package/mysql-core/query-builders/select.js +4 -0
  611. package/mysql-core/query-builders/select.js.map +1 -1
  612. package/mysql-core/session.cjs +1 -2
  613. package/mysql-core/session.cjs.map +1 -1
  614. package/mysql-core/session.d.cts +3 -4
  615. package/mysql-core/session.d.ts +3 -4
  616. package/mysql-core/session.js +1 -2
  617. package/mysql-core/session.js.map +1 -1
  618. package/mysql-core/table.cjs +1 -1
  619. package/mysql-core/table.cjs.map +1 -1
  620. package/mysql-core/table.js +1 -1
  621. package/mysql-core/table.js.map +1 -1
  622. package/mysql-proxy/driver.cjs +5 -2
  623. package/mysql-proxy/driver.cjs.map +1 -1
  624. package/mysql-proxy/driver.js +5 -2
  625. package/mysql-proxy/driver.js.map +1 -1
  626. package/mysql-proxy/session.cjs +25 -18
  627. package/mysql-proxy/session.cjs.map +1 -1
  628. package/mysql-proxy/session.d.cts +11 -4
  629. package/mysql-proxy/session.d.ts +12 -5
  630. package/mysql-proxy/session.js +26 -19
  631. package/mysql-proxy/session.js.map +1 -1
  632. package/mysql2/driver.cjs +3 -2
  633. package/mysql2/driver.cjs.map +1 -1
  634. package/mysql2/driver.d.cts +1 -0
  635. package/mysql2/driver.d.ts +3 -2
  636. package/mysql2/driver.js +3 -2
  637. package/mysql2/driver.js.map +1 -1
  638. package/mysql2/session.cjs +48 -38
  639. package/mysql2/session.cjs.map +1 -1
  640. package/mysql2/session.d.cts +11 -4
  641. package/mysql2/session.d.ts +12 -5
  642. package/mysql2/session.js +49 -39
  643. package/mysql2/session.js.map +1 -1
  644. package/neon-http/driver.cjs +34 -65
  645. package/neon-http/driver.cjs.map +1 -1
  646. package/neon-http/driver.d.cts +15 -19
  647. package/neon-http/driver.d.ts +16 -20
  648. package/neon-http/driver.js +34 -64
  649. package/neon-http/driver.js.map +1 -1
  650. package/neon-http/index.cjs +2 -4
  651. package/neon-http/index.d.cts +3 -3
  652. package/neon-http/index.d.ts +3 -3
  653. package/neon-http/index.js +3 -3
  654. package/neon-http/migrator.cjs +1 -1
  655. package/neon-http/migrator.cjs.map +1 -1
  656. package/neon-http/migrator.d.cts +1 -1
  657. package/neon-http/migrator.d.ts +1 -1
  658. package/neon-http/migrator.js +1 -1
  659. package/neon-http/migrator.js.map +1 -1
  660. package/neon-http/session.cjs +27 -116
  661. package/neon-http/session.cjs.map +1 -1
  662. package/neon-http/session.d.cts +10 -38
  663. package/neon-http/session.d.ts +10 -38
  664. package/neon-http/session.js +29 -116
  665. package/neon-http/session.js.map +1 -1
  666. package/neon-serverless/driver.cjs +14 -32
  667. package/neon-serverless/driver.cjs.map +1 -1
  668. package/neon-serverless/driver.d.cts +12 -17
  669. package/neon-serverless/driver.d.ts +13 -18
  670. package/neon-serverless/driver.js +14 -31
  671. package/neon-serverless/driver.js.map +1 -1
  672. package/neon-serverless/index.cjs +2 -3
  673. package/neon-serverless/index.d.cts +3 -3
  674. package/neon-serverless/index.d.ts +3 -3
  675. package/neon-serverless/index.js +3 -3
  676. package/neon-serverless/migrator.cjs.map +1 -1
  677. package/neon-serverless/migrator.d.cts +1 -1
  678. package/neon-serverless/migrator.d.ts +1 -1
  679. package/neon-serverless/migrator.js.map +1 -1
  680. package/neon-serverless/session.cjs +32 -108
  681. package/neon-serverless/session.cjs.map +1 -1
  682. package/neon-serverless/session.d.cts +9 -32
  683. package/neon-serverless/session.d.ts +9 -32
  684. package/neon-serverless/session.js +34 -109
  685. package/neon-serverless/session.js.map +1 -1
  686. package/netlify-db/driver.cjs +36 -43
  687. package/netlify-db/driver.cjs.map +1 -1
  688. package/netlify-db/driver.d.cts +29 -29
  689. package/netlify-db/driver.d.ts +31 -31
  690. package/netlify-db/driver.js +35 -42
  691. package/netlify-db/driver.js.map +1 -1
  692. package/netlify-db/index.cjs +3 -2
  693. package/netlify-db/index.d.cts +3 -3
  694. package/netlify-db/index.d.ts +3 -3
  695. package/netlify-db/index.js +2 -2
  696. package/netlify-db/migrator.cjs.map +1 -1
  697. package/netlify-db/migrator.d.cts +1 -1
  698. package/netlify-db/migrator.d.ts +1 -1
  699. package/netlify-db/migrator.js.map +1 -1
  700. package/netlify-db/session.cjs +61 -39
  701. package/netlify-db/session.cjs.map +1 -1
  702. package/netlify-db/session.d.cts +22 -23
  703. package/netlify-db/session.d.ts +23 -24
  704. package/netlify-db/session.js +63 -41
  705. package/netlify-db/session.js.map +1 -1
  706. package/node-mssql/driver.cjs +9 -3
  707. package/node-mssql/driver.cjs.map +1 -1
  708. package/node-mssql/driver.d.cts +1 -0
  709. package/node-mssql/driver.d.ts +2 -1
  710. package/node-mssql/driver.js +9 -3
  711. package/node-mssql/driver.js.map +1 -1
  712. package/node-mssql/session.cjs +6 -4
  713. package/node-mssql/session.cjs.map +1 -1
  714. package/node-mssql/session.d.cts +4 -1
  715. package/node-mssql/session.d.ts +5 -2
  716. package/node-mssql/session.js +7 -5
  717. package/node-mssql/session.js.map +1 -1
  718. package/node-postgres/driver.cjs +15 -18
  719. package/node-postgres/driver.cjs.map +1 -1
  720. package/node-postgres/driver.d.cts +11 -6
  721. package/node-postgres/driver.d.ts +12 -7
  722. package/node-postgres/driver.js +15 -18
  723. package/node-postgres/driver.js.map +1 -1
  724. package/node-postgres/index.cjs +2 -2
  725. package/node-postgres/index.d.cts +3 -3
  726. package/node-postgres/index.d.ts +3 -3
  727. package/node-postgres/index.js +3 -3
  728. package/node-postgres/migrator.cjs.map +1 -1
  729. package/node-postgres/migrator.d.cts +1 -1
  730. package/node-postgres/migrator.d.ts +1 -1
  731. package/node-postgres/migrator.js.map +1 -1
  732. package/node-postgres/session.cjs +32 -125
  733. package/node-postgres/session.cjs.map +1 -1
  734. package/node-postgres/session.d.cts +10 -30
  735. package/node-postgres/session.d.ts +9 -29
  736. package/node-postgres/session.js +34 -126
  737. package/node-postgres/session.js.map +1 -1
  738. package/node-sqlite/driver.cjs +1 -1
  739. package/node-sqlite/driver.d.ts +1 -1
  740. package/node-sqlite/driver.js +1 -1
  741. package/node-sqlite/session.cjs +4 -9
  742. package/node-sqlite/session.cjs.map +1 -1
  743. package/node-sqlite/session.d.cts +3 -4
  744. package/node-sqlite/session.d.ts +4 -5
  745. package/node-sqlite/session.js +4 -9
  746. package/node-sqlite/session.js.map +1 -1
  747. package/op-sqlite/driver.cjs +3 -2
  748. package/op-sqlite/driver.cjs.map +1 -1
  749. package/op-sqlite/driver.d.ts +1 -1
  750. package/op-sqlite/driver.js +3 -2
  751. package/op-sqlite/driver.js.map +1 -1
  752. package/op-sqlite/session.cjs +17 -15
  753. package/op-sqlite/session.cjs.map +1 -1
  754. package/op-sqlite/session.d.cts +10 -6
  755. package/op-sqlite/session.d.ts +10 -6
  756. package/op-sqlite/session.js +18 -16
  757. package/op-sqlite/session.js.map +1 -1
  758. package/operations.d.cts +3 -0
  759. package/operations.d.ts +3 -0
  760. package/package.json +43 -31
  761. package/pg-core/{utils/array.cjs → array.cjs} +1 -1
  762. package/pg-core/array.cjs.map +1 -0
  763. package/pg-core/{utils/array.d.cts → array.d.cts} +1 -1
  764. package/pg-core/{utils/array.d.ts → array.d.ts} +1 -1
  765. package/pg-core/{utils/array.js → array.js} +1 -1
  766. package/pg-core/array.js.map +1 -0
  767. package/pg-core/async/count.cjs +2 -9
  768. package/pg-core/async/count.cjs.map +1 -1
  769. package/pg-core/async/count.js +2 -9
  770. package/pg-core/async/count.js.map +1 -1
  771. package/pg-core/async/db.cjs +8 -28
  772. package/pg-core/async/db.cjs.map +1 -1
  773. package/pg-core/async/db.d.cts +5 -13
  774. package/pg-core/async/db.d.ts +6 -14
  775. package/pg-core/async/db.js +8 -28
  776. package/pg-core/async/db.js.map +1 -1
  777. package/pg-core/async/delete.cjs +7 -12
  778. package/pg-core/async/delete.cjs.map +1 -1
  779. package/pg-core/async/delete.js +7 -12
  780. package/pg-core/async/delete.js.map +1 -1
  781. package/pg-core/async/insert.cjs +7 -12
  782. package/pg-core/async/insert.cjs.map +1 -1
  783. package/pg-core/async/insert.js +7 -12
  784. package/pg-core/async/insert.js.map +1 -1
  785. package/pg-core/async/query.cjs +8 -14
  786. package/pg-core/async/query.cjs.map +1 -1
  787. package/pg-core/async/query.js +8 -14
  788. package/pg-core/async/query.js.map +1 -1
  789. package/pg-core/async/refresh-materialized-view.cjs +1 -9
  790. package/pg-core/async/refresh-materialized-view.cjs.map +1 -1
  791. package/pg-core/async/refresh-materialized-view.js +1 -9
  792. package/pg-core/async/refresh-materialized-view.js.map +1 -1
  793. package/pg-core/async/select.cjs +4 -13
  794. package/pg-core/async/select.cjs.map +1 -1
  795. package/pg-core/async/select.js +4 -13
  796. package/pg-core/async/select.js.map +1 -1
  797. package/pg-core/async/session.cjs +44 -20
  798. package/pg-core/async/session.cjs.map +1 -1
  799. package/pg-core/async/session.d.cts +25 -31
  800. package/pg-core/async/session.d.ts +26 -32
  801. package/pg-core/async/session.js +45 -21
  802. package/pg-core/async/session.js.map +1 -1
  803. package/pg-core/async/update.cjs +11 -15
  804. package/pg-core/async/update.cjs.map +1 -1
  805. package/pg-core/async/update.js +11 -15
  806. package/pg-core/async/update.js.map +1 -1
  807. package/pg-core/codecs.cjs +156 -0
  808. package/pg-core/codecs.cjs.map +1 -0
  809. package/pg-core/codecs.d.cts +27 -0
  810. package/pg-core/codecs.d.ts +27 -0
  811. package/pg-core/codecs.js +148 -0
  812. package/pg-core/codecs.js.map +1 -0
  813. package/pg-core/columns/bigint.cjs +10 -9
  814. package/pg-core/columns/bigint.cjs.map +1 -1
  815. package/pg-core/columns/bigint.d.cts +2 -3
  816. package/pg-core/columns/bigint.d.ts +2 -3
  817. package/pg-core/columns/bigint.js +10 -9
  818. package/pg-core/columns/bigint.js.map +1 -1
  819. package/pg-core/columns/bigserial.cjs +6 -6
  820. package/pg-core/columns/bigserial.cjs.map +1 -1
  821. package/pg-core/columns/bigserial.d.cts +1 -2
  822. package/pg-core/columns/bigserial.d.ts +1 -2
  823. package/pg-core/columns/bigserial.js +6 -6
  824. package/pg-core/columns/bigserial.js.map +1 -1
  825. package/pg-core/columns/boolean.cjs +2 -0
  826. package/pg-core/columns/boolean.cjs.map +1 -1
  827. package/pg-core/columns/boolean.js +2 -0
  828. package/pg-core/columns/boolean.js.map +1 -1
  829. package/pg-core/columns/bytea.cjs +2 -8
  830. package/pg-core/columns/bytea.cjs.map +1 -1
  831. package/pg-core/columns/bytea.d.cts +0 -1
  832. package/pg-core/columns/bytea.d.ts +0 -1
  833. package/pg-core/columns/bytea.js +2 -8
  834. package/pg-core/columns/bytea.js.map +1 -1
  835. package/pg-core/columns/char.cjs +2 -0
  836. package/pg-core/columns/char.cjs.map +1 -1
  837. package/pg-core/columns/char.js +2 -0
  838. package/pg-core/columns/char.js.map +1 -1
  839. package/pg-core/columns/cidr.cjs +2 -0
  840. package/pg-core/columns/cidr.cjs.map +1 -1
  841. package/pg-core/columns/cidr.js +2 -0
  842. package/pg-core/columns/cidr.js.map +1 -1
  843. package/pg-core/columns/common.cjs +10 -8
  844. package/pg-core/columns/common.cjs.map +1 -1
  845. package/pg-core/columns/common.d.cts +34 -39
  846. package/pg-core/columns/common.d.ts +34 -39
  847. package/pg-core/columns/common.js +10 -8
  848. package/pg-core/columns/common.js.map +1 -1
  849. package/pg-core/columns/custom.cjs +16 -46
  850. package/pg-core/columns/custom.cjs.map +1 -1
  851. package/pg-core/columns/custom.d.cts +17 -8
  852. package/pg-core/columns/custom.d.ts +17 -8
  853. package/pg-core/columns/custom.js +16 -46
  854. package/pg-core/columns/custom.js.map +1 -1
  855. package/pg-core/columns/date.cjs +11 -12
  856. package/pg-core/columns/date.cjs.map +1 -1
  857. package/pg-core/columns/date.d.cts +3 -4
  858. package/pg-core/columns/date.d.ts +3 -4
  859. package/pg-core/columns/date.js +11 -12
  860. package/pg-core/columns/date.js.map +1 -1
  861. package/pg-core/columns/double-precision.cjs +2 -4
  862. package/pg-core/columns/double-precision.cjs.map +1 -1
  863. package/pg-core/columns/double-precision.d.cts +0 -1
  864. package/pg-core/columns/double-precision.d.ts +0 -1
  865. package/pg-core/columns/double-precision.js +2 -4
  866. package/pg-core/columns/double-precision.js.map +1 -1
  867. package/pg-core/columns/enum.cjs +4 -0
  868. package/pg-core/columns/enum.cjs.map +1 -1
  869. package/pg-core/columns/enum.js +4 -0
  870. package/pg-core/columns/enum.js.map +1 -1
  871. package/pg-core/columns/index.d.cts +2 -2
  872. package/pg-core/columns/index.d.ts +2 -2
  873. package/pg-core/columns/inet.cjs +2 -0
  874. package/pg-core/columns/inet.cjs.map +1 -1
  875. package/pg-core/columns/inet.js +2 -0
  876. package/pg-core/columns/inet.js.map +1 -1
  877. package/pg-core/columns/integer.cjs +2 -4
  878. package/pg-core/columns/integer.cjs.map +1 -1
  879. package/pg-core/columns/integer.d.cts +0 -1
  880. package/pg-core/columns/integer.d.ts +0 -1
  881. package/pg-core/columns/integer.js +2 -4
  882. package/pg-core/columns/integer.js.map +1 -1
  883. package/pg-core/columns/interval.cjs +2 -0
  884. package/pg-core/columns/interval.cjs.map +1 -1
  885. package/pg-core/columns/interval.js +2 -0
  886. package/pg-core/columns/interval.js.map +1 -1
  887. package/pg-core/columns/json.cjs +2 -11
  888. package/pg-core/columns/json.cjs.map +1 -1
  889. package/pg-core/columns/json.d.cts +0 -2
  890. package/pg-core/columns/json.d.ts +0 -2
  891. package/pg-core/columns/json.js +2 -11
  892. package/pg-core/columns/json.js.map +1 -1
  893. package/pg-core/columns/jsonb.cjs +2 -11
  894. package/pg-core/columns/jsonb.cjs.map +1 -1
  895. package/pg-core/columns/jsonb.d.cts +0 -2
  896. package/pg-core/columns/jsonb.d.ts +0 -2
  897. package/pg-core/columns/jsonb.js +2 -11
  898. package/pg-core/columns/jsonb.js.map +1 -1
  899. package/pg-core/columns/line.cjs +12 -8
  900. package/pg-core/columns/line.cjs.map +1 -1
  901. package/pg-core/columns/line.d.cts +5 -5
  902. package/pg-core/columns/line.d.ts +5 -5
  903. package/pg-core/columns/line.js +12 -8
  904. package/pg-core/columns/line.js.map +1 -1
  905. package/pg-core/columns/macaddr.cjs +2 -0
  906. package/pg-core/columns/macaddr.cjs.map +1 -1
  907. package/pg-core/columns/macaddr.js +2 -0
  908. package/pg-core/columns/macaddr.js.map +1 -1
  909. package/pg-core/columns/macaddr8.cjs +2 -0
  910. package/pg-core/columns/macaddr8.cjs.map +1 -1
  911. package/pg-core/columns/macaddr8.js +2 -0
  912. package/pg-core/columns/macaddr8.js.map +1 -1
  913. package/pg-core/columns/numeric.cjs +12 -15
  914. package/pg-core/columns/numeric.cjs.map +1 -1
  915. package/pg-core/columns/numeric.d.cts +4 -5
  916. package/pg-core/columns/numeric.d.ts +4 -5
  917. package/pg-core/columns/numeric.js +12 -15
  918. package/pg-core/columns/numeric.js.map +1 -1
  919. package/pg-core/columns/point.cjs +19 -21
  920. package/pg-core/columns/point.cjs.map +1 -1
  921. package/pg-core/columns/point.d.cts +5 -11
  922. package/pg-core/columns/point.d.ts +5 -11
  923. package/pg-core/columns/point.js +19 -21
  924. package/pg-core/columns/point.js.map +1 -1
  925. package/pg-core/columns/postgis_extension/geometry.cjs +12 -9
  926. package/pg-core/columns/postgis_extension/geometry.cjs.map +1 -1
  927. package/pg-core/columns/postgis_extension/geometry.d.cts +5 -5
  928. package/pg-core/columns/postgis_extension/geometry.d.ts +5 -5
  929. package/pg-core/columns/postgis_extension/geometry.js +12 -9
  930. package/pg-core/columns/postgis_extension/geometry.js.map +1 -1
  931. package/pg-core/columns/real.cjs +2 -4
  932. package/pg-core/columns/real.cjs.map +1 -1
  933. package/pg-core/columns/real.d.cts +0 -1
  934. package/pg-core/columns/real.d.ts +0 -1
  935. package/pg-core/columns/real.js +2 -4
  936. package/pg-core/columns/real.js.map +1 -1
  937. package/pg-core/columns/serial.cjs +2 -0
  938. package/pg-core/columns/serial.cjs.map +1 -1
  939. package/pg-core/columns/serial.js +2 -0
  940. package/pg-core/columns/serial.js.map +1 -1
  941. package/pg-core/columns/smallint.cjs +2 -4
  942. package/pg-core/columns/smallint.cjs.map +1 -1
  943. package/pg-core/columns/smallint.d.cts +0 -1
  944. package/pg-core/columns/smallint.d.ts +0 -1
  945. package/pg-core/columns/smallint.js +2 -4
  946. package/pg-core/columns/smallint.js.map +1 -1
  947. package/pg-core/columns/smallserial.cjs +2 -0
  948. package/pg-core/columns/smallserial.cjs.map +1 -1
  949. package/pg-core/columns/smallserial.js +2 -0
  950. package/pg-core/columns/smallserial.js.map +1 -1
  951. package/pg-core/columns/text.cjs +2 -0
  952. package/pg-core/columns/text.cjs.map +1 -1
  953. package/pg-core/columns/text.js +2 -0
  954. package/pg-core/columns/text.js.map +1 -1
  955. package/pg-core/columns/time.cjs +2 -0
  956. package/pg-core/columns/time.cjs.map +1 -1
  957. package/pg-core/columns/time.js +2 -0
  958. package/pg-core/columns/time.js.map +1 -1
  959. package/pg-core/columns/timestamp.cjs +13 -14
  960. package/pg-core/columns/timestamp.cjs.map +1 -1
  961. package/pg-core/columns/timestamp.d.cts +3 -4
  962. package/pg-core/columns/timestamp.d.ts +3 -4
  963. package/pg-core/columns/timestamp.js +13 -14
  964. package/pg-core/columns/timestamp.js.map +1 -1
  965. package/pg-core/columns/uuid.cjs +2 -0
  966. package/pg-core/columns/uuid.cjs.map +1 -1
  967. package/pg-core/columns/uuid.js +2 -0
  968. package/pg-core/columns/uuid.js.map +1 -1
  969. package/pg-core/columns/varchar.cjs +2 -0
  970. package/pg-core/columns/varchar.cjs.map +1 -1
  971. package/pg-core/columns/varchar.js +2 -0
  972. package/pg-core/columns/varchar.js.map +1 -1
  973. package/pg-core/columns/vector_extension/bit.cjs +2 -0
  974. package/pg-core/columns/vector_extension/bit.cjs.map +1 -1
  975. package/pg-core/columns/vector_extension/bit.js +2 -0
  976. package/pg-core/columns/vector_extension/bit.js.map +1 -1
  977. package/pg-core/columns/vector_extension/halfvec.cjs +6 -4
  978. package/pg-core/columns/vector_extension/halfvec.cjs.map +1 -1
  979. package/pg-core/columns/vector_extension/halfvec.d.cts +2 -2
  980. package/pg-core/columns/vector_extension/halfvec.d.ts +2 -2
  981. package/pg-core/columns/vector_extension/halfvec.js +6 -4
  982. package/pg-core/columns/vector_extension/halfvec.js.map +1 -1
  983. package/pg-core/columns/vector_extension/sparsevec.cjs +2 -0
  984. package/pg-core/columns/vector_extension/sparsevec.cjs.map +1 -1
  985. package/pg-core/columns/vector_extension/sparsevec.js +2 -0
  986. package/pg-core/columns/vector_extension/sparsevec.js.map +1 -1
  987. package/pg-core/columns/vector_extension/vector.cjs +6 -4
  988. package/pg-core/columns/vector_extension/vector.cjs.map +1 -1
  989. package/pg-core/columns/vector_extension/vector.d.cts +2 -2
  990. package/pg-core/columns/vector_extension/vector.d.ts +2 -2
  991. package/pg-core/columns/vector_extension/vector.js +6 -4
  992. package/pg-core/columns/vector_extension/vector.js.map +1 -1
  993. package/pg-core/dialect.cjs +73 -226
  994. package/pg-core/dialect.cjs.map +1 -1
  995. package/pg-core/dialect.d.cts +27 -34
  996. package/pg-core/dialect.d.ts +27 -34
  997. package/pg-core/dialect.js +78 -230
  998. package/pg-core/dialect.js.map +1 -1
  999. package/pg-core/effect/count.cjs +1 -1
  1000. package/pg-core/effect/count.cjs.map +1 -1
  1001. package/pg-core/effect/count.d.cts +2 -2
  1002. package/pg-core/effect/count.d.ts +2 -2
  1003. package/pg-core/effect/count.js +1 -1
  1004. package/pg-core/effect/count.js.map +1 -1
  1005. package/pg-core/effect/db.cjs +9 -18
  1006. package/pg-core/effect/db.cjs.map +1 -1
  1007. package/pg-core/effect/db.d.cts +7 -11
  1008. package/pg-core/effect/db.d.ts +6 -10
  1009. package/pg-core/effect/db.js +9 -18
  1010. package/pg-core/effect/db.js.map +1 -1
  1011. package/pg-core/effect/delete.cjs +7 -5
  1012. package/pg-core/effect/delete.cjs.map +1 -1
  1013. package/pg-core/effect/delete.d.cts +1 -1
  1014. package/pg-core/effect/delete.d.ts +1 -1
  1015. package/pg-core/effect/delete.js +7 -5
  1016. package/pg-core/effect/delete.js.map +1 -1
  1017. package/pg-core/effect/insert.cjs +7 -5
  1018. package/pg-core/effect/insert.cjs.map +1 -1
  1019. package/pg-core/effect/insert.d.cts +1 -1
  1020. package/pg-core/effect/insert.d.ts +1 -1
  1021. package/pg-core/effect/insert.js +7 -5
  1022. package/pg-core/effect/insert.js.map +1 -1
  1023. package/pg-core/effect/query.cjs +7 -6
  1024. package/pg-core/effect/query.cjs.map +1 -1
  1025. package/pg-core/effect/query.d.cts +1 -1
  1026. package/pg-core/effect/query.d.ts +1 -1
  1027. package/pg-core/effect/query.js +7 -6
  1028. package/pg-core/effect/query.js.map +1 -1
  1029. package/pg-core/effect/refresh-materialized-view.cjs +1 -2
  1030. package/pg-core/effect/refresh-materialized-view.cjs.map +1 -1
  1031. package/pg-core/effect/refresh-materialized-view.d.cts +1 -1
  1032. package/pg-core/effect/refresh-materialized-view.d.ts +1 -1
  1033. package/pg-core/effect/refresh-materialized-view.js +1 -2
  1034. package/pg-core/effect/refresh-materialized-view.js.map +1 -1
  1035. package/pg-core/effect/select.cjs +3 -5
  1036. package/pg-core/effect/select.cjs.map +1 -1
  1037. package/pg-core/effect/select.d.cts +1 -1
  1038. package/pg-core/effect/select.d.ts +1 -1
  1039. package/pg-core/effect/select.js +3 -5
  1040. package/pg-core/effect/select.js.map +1 -1
  1041. package/pg-core/effect/session.cjs +28 -17
  1042. package/pg-core/effect/session.cjs.map +1 -1
  1043. package/pg-core/effect/session.d.cts +24 -28
  1044. package/pg-core/effect/session.d.ts +25 -29
  1045. package/pg-core/effect/session.js +29 -18
  1046. package/pg-core/effect/session.js.map +1 -1
  1047. package/pg-core/effect/update.cjs +8 -8
  1048. package/pg-core/effect/update.cjs.map +1 -1
  1049. package/pg-core/effect/update.d.cts +1 -1
  1050. package/pg-core/effect/update.d.ts +1 -1
  1051. package/pg-core/effect/update.js +8 -8
  1052. package/pg-core/effect/update.js.map +1 -1
  1053. package/pg-core/index.cjs +4 -4
  1054. package/pg-core/index.d.cts +4 -4
  1055. package/pg-core/index.d.ts +4 -4
  1056. package/pg-core/index.js +1 -1
  1057. package/pg-core/query-builders/delete.cjs +6 -2
  1058. package/pg-core/query-builders/delete.cjs.map +1 -1
  1059. package/pg-core/query-builders/delete.d.cts +2 -0
  1060. package/pg-core/query-builders/delete.d.ts +2 -0
  1061. package/pg-core/query-builders/delete.js +6 -2
  1062. package/pg-core/query-builders/delete.js.map +1 -1
  1063. package/pg-core/query-builders/insert.cjs +7 -2
  1064. package/pg-core/query-builders/insert.cjs.map +1 -1
  1065. package/pg-core/query-builders/insert.d.cts +2 -0
  1066. package/pg-core/query-builders/insert.d.ts +2 -0
  1067. package/pg-core/query-builders/insert.js +7 -2
  1068. package/pg-core/query-builders/insert.js.map +1 -1
  1069. package/pg-core/query-builders/query-builder.cjs +2 -1
  1070. package/pg-core/query-builders/query-builder.cjs.map +1 -1
  1071. package/pg-core/query-builders/query-builder.js +2 -1
  1072. package/pg-core/query-builders/query-builder.js.map +1 -1
  1073. package/pg-core/query-builders/query.cjs +0 -1
  1074. package/pg-core/query-builders/query.cjs.map +1 -1
  1075. package/pg-core/query-builders/query.d.cts +2 -1
  1076. package/pg-core/query-builders/query.d.ts +2 -1
  1077. package/pg-core/query-builders/query.js +0 -1
  1078. package/pg-core/query-builders/query.js.map +1 -1
  1079. package/pg-core/query-builders/raw.cjs +0 -4
  1080. package/pg-core/query-builders/raw.cjs.map +1 -1
  1081. package/pg-core/query-builders/raw.js +0 -4
  1082. package/pg-core/query-builders/raw.js.map +1 -1
  1083. package/pg-core/query-builders/select.cjs +6 -2
  1084. package/pg-core/query-builders/select.cjs.map +1 -1
  1085. package/pg-core/query-builders/select.d.cts +1 -0
  1086. package/pg-core/query-builders/select.d.ts +1 -0
  1087. package/pg-core/query-builders/select.js +6 -2
  1088. package/pg-core/query-builders/select.js.map +1 -1
  1089. package/pg-core/query-builders/select.types.d.cts +1 -0
  1090. package/pg-core/query-builders/select.types.d.ts +1 -0
  1091. package/pg-core/query-builders/update.cjs +6 -2
  1092. package/pg-core/query-builders/update.cjs.map +1 -1
  1093. package/pg-core/query-builders/update.d.cts +2 -0
  1094. package/pg-core/query-builders/update.d.ts +2 -0
  1095. package/pg-core/query-builders/update.js +6 -2
  1096. package/pg-core/query-builders/update.js.map +1 -1
  1097. package/pg-core/session.cjs +3 -5
  1098. package/pg-core/session.cjs.map +1 -1
  1099. package/pg-core/session.d.cts +4 -7
  1100. package/pg-core/session.d.ts +4 -7
  1101. package/pg-core/session.js +3 -5
  1102. package/pg-core/session.js.map +1 -1
  1103. package/pg-core/table.cjs +1 -1
  1104. package/pg-core/table.cjs.map +1 -1
  1105. package/pg-core/table.js +1 -1
  1106. package/pg-core/table.js.map +1 -1
  1107. package/pg-core/utils.cjs.map +1 -1
  1108. package/pg-core/utils.d.cts +7 -1
  1109. package/pg-core/utils.d.ts +7 -1
  1110. package/pg-core/utils.js.map +1 -1
  1111. package/pg-core/view.cjs +2 -2
  1112. package/pg-core/view.cjs.map +1 -1
  1113. package/pg-core/view.js +2 -2
  1114. package/pg-core/view.js.map +1 -1
  1115. package/pg-proxy/driver.cjs +10 -15
  1116. package/pg-proxy/driver.cjs.map +1 -1
  1117. package/pg-proxy/driver.d.cts +6 -3
  1118. package/pg-proxy/driver.d.ts +6 -3
  1119. package/pg-proxy/driver.js +10 -14
  1120. package/pg-proxy/driver.js.map +1 -1
  1121. package/pg-proxy/index.cjs +0 -2
  1122. package/pg-proxy/index.d.cts +2 -2
  1123. package/pg-proxy/index.d.ts +2 -2
  1124. package/pg-proxy/index.js +2 -2
  1125. package/pg-proxy/migrator.cjs.map +1 -1
  1126. package/pg-proxy/migrator.d.cts +1 -1
  1127. package/pg-proxy/migrator.d.ts +1 -1
  1128. package/pg-proxy/migrator.js.map +1 -1
  1129. package/pg-proxy/session.cjs +8 -84
  1130. package/pg-proxy/session.cjs.map +1 -1
  1131. package/pg-proxy/session.d.cts +9 -32
  1132. package/pg-proxy/session.d.ts +9 -32
  1133. package/pg-proxy/session.js +10 -84
  1134. package/pg-proxy/session.js.map +1 -1
  1135. package/pglite/driver.cjs +71 -33
  1136. package/pglite/driver.cjs.map +1 -1
  1137. package/pglite/driver.d.cts +12 -17
  1138. package/pglite/driver.d.ts +13 -18
  1139. package/pglite/driver.js +71 -32
  1140. package/pglite/driver.js.map +1 -1
  1141. package/pglite/index.cjs +2 -3
  1142. package/pglite/index.d.cts +3 -3
  1143. package/pglite/index.d.ts +3 -3
  1144. package/pglite/index.js +3 -3
  1145. package/pglite/migrator.cjs.map +1 -1
  1146. package/pglite/migrator.d.cts +1 -1
  1147. package/pglite/migrator.d.ts +1 -1
  1148. package/pglite/migrator.js.map +1 -1
  1149. package/pglite/session.cjs +24 -85
  1150. package/pglite/session.cjs.map +1 -1
  1151. package/pglite/session.d.cts +9 -30
  1152. package/pglite/session.d.ts +9 -30
  1153. package/pglite/session.js +26 -86
  1154. package/pglite/session.js.map +1 -1
  1155. package/planetscale-serverless/driver.cjs +3 -2
  1156. package/planetscale-serverless/driver.cjs.map +1 -1
  1157. package/planetscale-serverless/driver.d.cts +1 -0
  1158. package/planetscale-serverless/driver.d.ts +1 -0
  1159. package/planetscale-serverless/driver.js +3 -2
  1160. package/planetscale-serverless/driver.js.map +1 -1
  1161. package/planetscale-serverless/session.cjs +26 -19
  1162. package/planetscale-serverless/session.cjs.map +1 -1
  1163. package/planetscale-serverless/session.d.cts +12 -6
  1164. package/planetscale-serverless/session.d.ts +13 -7
  1165. package/planetscale-serverless/session.js +27 -20
  1166. package/planetscale-serverless/session.js.map +1 -1
  1167. package/postgres-js/driver.cjs +124 -19
  1168. package/postgres-js/driver.cjs.map +1 -1
  1169. package/postgres-js/driver.d.cts +10 -6
  1170. package/postgres-js/driver.d.ts +10 -6
  1171. package/postgres-js/driver.js +124 -19
  1172. package/postgres-js/driver.js.map +1 -1
  1173. package/postgres-js/index.cjs +2 -2
  1174. package/postgres-js/index.d.cts +3 -3
  1175. package/postgres-js/index.d.ts +3 -3
  1176. package/postgres-js/index.js +3 -3
  1177. package/postgres-js/migrator.cjs.map +1 -1
  1178. package/postgres-js/migrator.d.cts +1 -1
  1179. package/postgres-js/migrator.d.ts +1 -1
  1180. package/postgres-js/migrator.js.map +1 -1
  1181. package/postgres-js/session.cjs +16 -111
  1182. package/postgres-js/session.cjs.map +1 -1
  1183. package/postgres-js/session.d.cts +10 -31
  1184. package/postgres-js/session.d.ts +9 -30
  1185. package/postgres-js/session.js +17 -111
  1186. package/postgres-js/session.js.map +1 -1
  1187. package/prisma/mysql/session.cjs +2 -1
  1188. package/prisma/mysql/session.cjs.map +1 -1
  1189. package/prisma/mysql/session.d.cts +1 -0
  1190. package/prisma/mysql/session.d.ts +2 -1
  1191. package/prisma/mysql/session.js +2 -1
  1192. package/prisma/mysql/session.js.map +1 -1
  1193. package/prisma/pg/driver.cjs +9 -3
  1194. package/prisma/pg/driver.cjs.map +1 -1
  1195. package/prisma/pg/driver.d.cts +7 -3
  1196. package/prisma/pg/driver.d.ts +7 -3
  1197. package/prisma/pg/driver.js +9 -4
  1198. package/prisma/pg/driver.js.map +1 -1
  1199. package/prisma/pg/index.cjs +2 -2
  1200. package/prisma/pg/index.d.cts +3 -3
  1201. package/prisma/pg/index.d.ts +3 -3
  1202. package/prisma/pg/index.js +3 -3
  1203. package/prisma/pg/session.cjs +1 -25
  1204. package/prisma/pg/session.cjs.map +1 -1
  1205. package/prisma/pg/session.d.cts +3 -15
  1206. package/prisma/pg/session.d.ts +2 -14
  1207. package/prisma/pg/session.js +2 -25
  1208. package/prisma/pg/session.js.map +1 -1
  1209. package/prisma/sqlite/session.cjs +0 -3
  1210. package/prisma/sqlite/session.cjs.map +1 -1
  1211. package/prisma/sqlite/session.d.cts +0 -1
  1212. package/prisma/sqlite/session.d.ts +1 -2
  1213. package/prisma/sqlite/session.js +0 -3
  1214. package/prisma/sqlite/session.js.map +1 -1
  1215. package/query-builders/query-builder.cjs +4 -0
  1216. package/query-builders/query-builder.cjs.map +1 -1
  1217. package/query-builders/query-builder.js +4 -0
  1218. package/query-builders/query-builder.js.map +1 -1
  1219. package/relations.cjs +84 -23
  1220. package/relations.cjs.map +1 -1
  1221. package/relations.d.cts +41 -16
  1222. package/relations.d.ts +41 -16
  1223. package/relations.js +83 -24
  1224. package/relations.js.map +1 -1
  1225. package/row-mappers/index.cjs +1 -1
  1226. package/row-mappers/index.cjs.map +1 -1
  1227. package/row-mappers/index.js +1 -1
  1228. package/row-mappers/index.js.map +1 -1
  1229. package/singlestore/driver.cjs +4 -2
  1230. package/singlestore/driver.cjs.map +1 -1
  1231. package/singlestore/driver.d.cts +2 -1
  1232. package/singlestore/driver.d.ts +3 -2
  1233. package/singlestore/driver.js +4 -2
  1234. package/singlestore/driver.js.map +1 -1
  1235. package/singlestore/session.cjs +16 -6
  1236. package/singlestore/session.cjs.map +1 -1
  1237. package/singlestore/session.d.cts +8 -4
  1238. package/singlestore/session.d.ts +8 -4
  1239. package/singlestore/session.js +17 -7
  1240. package/singlestore/session.js.map +1 -1
  1241. package/singlestore-core/columns/bigint.cjs +4 -4
  1242. package/singlestore-core/columns/bigint.cjs.map +1 -1
  1243. package/singlestore-core/columns/bigint.d.cts +2 -2
  1244. package/singlestore-core/columns/bigint.d.ts +2 -2
  1245. package/singlestore-core/columns/bigint.js +4 -4
  1246. package/singlestore-core/columns/bigint.js.map +1 -1
  1247. package/singlestore-core/columns/binary.cjs +2 -2
  1248. package/singlestore-core/columns/binary.cjs.map +1 -1
  1249. package/singlestore-core/columns/binary.d.cts +1 -1
  1250. package/singlestore-core/columns/binary.d.ts +1 -1
  1251. package/singlestore-core/columns/binary.js +2 -2
  1252. package/singlestore-core/columns/binary.js.map +1 -1
  1253. package/singlestore-core/columns/boolean.cjs +2 -2
  1254. package/singlestore-core/columns/boolean.cjs.map +1 -1
  1255. package/singlestore-core/columns/boolean.d.cts +1 -1
  1256. package/singlestore-core/columns/boolean.d.ts +1 -1
  1257. package/singlestore-core/columns/boolean.js +2 -2
  1258. package/singlestore-core/columns/boolean.js.map +1 -1
  1259. package/singlestore-core/columns/custom.cjs +4 -4
  1260. package/singlestore-core/columns/custom.cjs.map +1 -1
  1261. package/singlestore-core/columns/custom.d.cts +2 -2
  1262. package/singlestore-core/columns/custom.d.ts +2 -2
  1263. package/singlestore-core/columns/custom.js +4 -4
  1264. package/singlestore-core/columns/custom.js.map +1 -1
  1265. package/singlestore-core/columns/date.cjs +2 -2
  1266. package/singlestore-core/columns/date.cjs.map +1 -1
  1267. package/singlestore-core/columns/date.d.cts +1 -1
  1268. package/singlestore-core/columns/date.d.ts +1 -1
  1269. package/singlestore-core/columns/date.js +2 -2
  1270. package/singlestore-core/columns/date.js.map +1 -1
  1271. package/singlestore-core/columns/datetime.cjs +6 -6
  1272. package/singlestore-core/columns/datetime.cjs.map +1 -1
  1273. package/singlestore-core/columns/datetime.d.cts +3 -3
  1274. package/singlestore-core/columns/datetime.d.ts +3 -3
  1275. package/singlestore-core/columns/datetime.js +6 -6
  1276. package/singlestore-core/columns/datetime.js.map +1 -1
  1277. package/singlestore-core/columns/decimal.cjs +4 -4
  1278. package/singlestore-core/columns/decimal.cjs.map +1 -1
  1279. package/singlestore-core/columns/decimal.d.cts +2 -2
  1280. package/singlestore-core/columns/decimal.d.ts +2 -2
  1281. package/singlestore-core/columns/decimal.js +4 -4
  1282. package/singlestore-core/columns/decimal.js.map +1 -1
  1283. package/singlestore-core/columns/float.cjs +2 -2
  1284. package/singlestore-core/columns/float.cjs.map +1 -1
  1285. package/singlestore-core/columns/float.d.cts +1 -1
  1286. package/singlestore-core/columns/float.d.ts +1 -1
  1287. package/singlestore-core/columns/float.js +2 -2
  1288. package/singlestore-core/columns/float.js.map +1 -1
  1289. package/singlestore-core/columns/int.cjs +2 -2
  1290. package/singlestore-core/columns/int.cjs.map +1 -1
  1291. package/singlestore-core/columns/int.d.cts +1 -1
  1292. package/singlestore-core/columns/int.d.ts +1 -1
  1293. package/singlestore-core/columns/int.js +2 -2
  1294. package/singlestore-core/columns/int.js.map +1 -1
  1295. package/singlestore-core/columns/json.cjs +2 -2
  1296. package/singlestore-core/columns/json.cjs.map +1 -1
  1297. package/singlestore-core/columns/json.d.cts +1 -1
  1298. package/singlestore-core/columns/json.d.ts +1 -1
  1299. package/singlestore-core/columns/json.js +2 -2
  1300. package/singlestore-core/columns/json.js.map +1 -1
  1301. package/singlestore-core/columns/mediumint.cjs +2 -2
  1302. package/singlestore-core/columns/mediumint.cjs.map +1 -1
  1303. package/singlestore-core/columns/mediumint.d.cts +1 -1
  1304. package/singlestore-core/columns/mediumint.d.ts +1 -1
  1305. package/singlestore-core/columns/mediumint.js +2 -2
  1306. package/singlestore-core/columns/mediumint.js.map +1 -1
  1307. package/singlestore-core/columns/serial.cjs +2 -2
  1308. package/singlestore-core/columns/serial.cjs.map +1 -1
  1309. package/singlestore-core/columns/serial.d.cts +1 -1
  1310. package/singlestore-core/columns/serial.d.ts +1 -1
  1311. package/singlestore-core/columns/serial.js +2 -2
  1312. package/singlestore-core/columns/serial.js.map +1 -1
  1313. package/singlestore-core/columns/smallint.cjs +2 -2
  1314. package/singlestore-core/columns/smallint.cjs.map +1 -1
  1315. package/singlestore-core/columns/smallint.d.cts +1 -1
  1316. package/singlestore-core/columns/smallint.d.ts +1 -1
  1317. package/singlestore-core/columns/smallint.js +2 -2
  1318. package/singlestore-core/columns/smallint.js.map +1 -1
  1319. package/singlestore-core/columns/timestamp.cjs +6 -6
  1320. package/singlestore-core/columns/timestamp.cjs.map +1 -1
  1321. package/singlestore-core/columns/timestamp.d.cts +3 -3
  1322. package/singlestore-core/columns/timestamp.d.ts +3 -3
  1323. package/singlestore-core/columns/timestamp.js +6 -6
  1324. package/singlestore-core/columns/timestamp.js.map +1 -1
  1325. package/singlestore-core/columns/tinyint.cjs +2 -2
  1326. package/singlestore-core/columns/tinyint.cjs.map +1 -1
  1327. package/singlestore-core/columns/tinyint.d.cts +1 -1
  1328. package/singlestore-core/columns/tinyint.d.ts +1 -1
  1329. package/singlestore-core/columns/tinyint.js +2 -2
  1330. package/singlestore-core/columns/tinyint.js.map +1 -1
  1331. package/singlestore-core/columns/varbinary.cjs +2 -2
  1332. package/singlestore-core/columns/varbinary.cjs.map +1 -1
  1333. package/singlestore-core/columns/varbinary.d.cts +1 -1
  1334. package/singlestore-core/columns/varbinary.d.ts +1 -1
  1335. package/singlestore-core/columns/varbinary.js +2 -2
  1336. package/singlestore-core/columns/varbinary.js.map +1 -1
  1337. package/singlestore-core/columns/vector.cjs +8 -8
  1338. package/singlestore-core/columns/vector.cjs.map +1 -1
  1339. package/singlestore-core/columns/vector.d.cts +4 -4
  1340. package/singlestore-core/columns/vector.d.ts +4 -4
  1341. package/singlestore-core/columns/vector.js +8 -8
  1342. package/singlestore-core/columns/vector.js.map +1 -1
  1343. package/singlestore-core/columns/year.cjs +2 -2
  1344. package/singlestore-core/columns/year.cjs.map +1 -1
  1345. package/singlestore-core/columns/year.d.cts +1 -1
  1346. package/singlestore-core/columns/year.d.ts +1 -1
  1347. package/singlestore-core/columns/year.js +2 -2
  1348. package/singlestore-core/columns/year.js.map +1 -1
  1349. package/singlestore-core/db.d.ts +1 -1
  1350. package/singlestore-core/dialect.cjs +1 -1
  1351. package/singlestore-core/dialect.d.ts +1 -1
  1352. package/singlestore-core/dialect.js +1 -1
  1353. package/singlestore-core/query-builders/query.cjs +13 -5
  1354. package/singlestore-core/query-builders/query.cjs.map +1 -1
  1355. package/singlestore-core/query-builders/query.d.ts +1 -1
  1356. package/singlestore-core/query-builders/query.js +13 -5
  1357. package/singlestore-core/query-builders/query.js.map +1 -1
  1358. package/singlestore-core/query-builders/select.cjs +4 -0
  1359. package/singlestore-core/query-builders/select.cjs.map +1 -1
  1360. package/singlestore-core/query-builders/select.js +4 -0
  1361. package/singlestore-core/query-builders/select.js.map +1 -1
  1362. package/singlestore-core/session.cjs.map +1 -1
  1363. package/singlestore-core/session.d.cts +2 -2
  1364. package/singlestore-core/session.d.ts +2 -2
  1365. package/singlestore-core/session.js.map +1 -1
  1366. package/singlestore-core/table.cjs +1 -1
  1367. package/singlestore-core/table.cjs.map +1 -1
  1368. package/singlestore-core/table.js +1 -1
  1369. package/singlestore-core/table.js.map +1 -1
  1370. package/singlestore-proxy/driver.cjs +5 -2
  1371. package/singlestore-proxy/driver.cjs.map +1 -1
  1372. package/singlestore-proxy/driver.js +5 -2
  1373. package/singlestore-proxy/driver.js.map +1 -1
  1374. package/singlestore-proxy/session.cjs +11 -6
  1375. package/singlestore-proxy/session.cjs.map +1 -1
  1376. package/singlestore-proxy/session.d.cts +9 -4
  1377. package/singlestore-proxy/session.d.ts +9 -4
  1378. package/singlestore-proxy/session.js +12 -7
  1379. package/singlestore-proxy/session.js.map +1 -1
  1380. package/sql/index.cjs +1 -0
  1381. package/sql/index.d.cts +2 -2
  1382. package/sql/index.d.ts +2 -2
  1383. package/sql/index.js +2 -2
  1384. package/sql/sql.cjs +32 -11
  1385. package/sql/sql.cjs.map +1 -1
  1386. package/sql/sql.d.cts +15 -5
  1387. package/sql/sql.d.ts +15 -5
  1388. package/sql/sql.js +32 -12
  1389. package/sql/sql.js.map +1 -1
  1390. package/sql-js/driver.cjs +5 -2
  1391. package/sql-js/driver.cjs.map +1 -1
  1392. package/sql-js/driver.d.ts +1 -1
  1393. package/sql-js/driver.js +5 -2
  1394. package/sql-js/driver.js.map +1 -1
  1395. package/sql-js/session.cjs +14 -14
  1396. package/sql-js/session.cjs.map +1 -1
  1397. package/sql-js/session.d.cts +10 -6
  1398. package/sql-js/session.d.ts +10 -6
  1399. package/sql-js/session.js +15 -15
  1400. package/sql-js/session.js.map +1 -1
  1401. package/sqlite-cloud/driver.cjs +3 -2
  1402. package/sqlite-cloud/driver.cjs.map +1 -1
  1403. package/sqlite-cloud/driver.d.ts +1 -1
  1404. package/sqlite-cloud/driver.js +3 -2
  1405. package/sqlite-cloud/driver.js.map +1 -1
  1406. package/sqlite-cloud/session.cjs +20 -19
  1407. package/sqlite-cloud/session.cjs.map +1 -1
  1408. package/sqlite-cloud/session.d.cts +9 -6
  1409. package/sqlite-cloud/session.d.ts +9 -6
  1410. package/sqlite-cloud/session.js +21 -20
  1411. package/sqlite-cloud/session.js.map +1 -1
  1412. package/sqlite-core/columns/blob.cjs +10 -10
  1413. package/sqlite-core/columns/blob.cjs.map +1 -1
  1414. package/sqlite-core/columns/blob.d.cts +5 -5
  1415. package/sqlite-core/columns/blob.d.ts +5 -5
  1416. package/sqlite-core/columns/blob.js +10 -10
  1417. package/sqlite-core/columns/blob.js.map +1 -1
  1418. package/sqlite-core/columns/custom.cjs +4 -4
  1419. package/sqlite-core/columns/custom.cjs.map +1 -1
  1420. package/sqlite-core/columns/custom.d.cts +2 -2
  1421. package/sqlite-core/columns/custom.d.ts +2 -2
  1422. package/sqlite-core/columns/custom.js +4 -4
  1423. package/sqlite-core/columns/custom.js.map +1 -1
  1424. package/sqlite-core/columns/integer.cjs +8 -8
  1425. package/sqlite-core/columns/integer.cjs.map +1 -1
  1426. package/sqlite-core/columns/integer.d.cts +4 -4
  1427. package/sqlite-core/columns/integer.d.ts +4 -4
  1428. package/sqlite-core/columns/integer.js +8 -8
  1429. package/sqlite-core/columns/integer.js.map +1 -1
  1430. package/sqlite-core/columns/numeric.cjs +4 -4
  1431. package/sqlite-core/columns/numeric.cjs.map +1 -1
  1432. package/sqlite-core/columns/numeric.d.cts +2 -2
  1433. package/sqlite-core/columns/numeric.d.ts +2 -2
  1434. package/sqlite-core/columns/numeric.js +4 -4
  1435. package/sqlite-core/columns/numeric.js.map +1 -1
  1436. package/sqlite-core/columns/text.cjs +4 -4
  1437. package/sqlite-core/columns/text.cjs.map +1 -1
  1438. package/sqlite-core/columns/text.d.cts +2 -2
  1439. package/sqlite-core/columns/text.d.ts +2 -2
  1440. package/sqlite-core/columns/text.js +4 -4
  1441. package/sqlite-core/columns/text.js.map +1 -1
  1442. package/sqlite-core/db.d.ts +1 -1
  1443. package/sqlite-core/dialect.cjs +2 -2
  1444. package/sqlite-core/dialect.d.ts +1 -1
  1445. package/sqlite-core/dialect.js +2 -2
  1446. package/sqlite-core/query-builders/_query.cjs +1 -1
  1447. package/sqlite-core/query-builders/_query.cjs.map +1 -1
  1448. package/sqlite-core/query-builders/_query.js +1 -1
  1449. package/sqlite-core/query-builders/_query.js.map +1 -1
  1450. package/sqlite-core/query-builders/delete.cjs +1 -1
  1451. package/sqlite-core/query-builders/delete.cjs.map +1 -1
  1452. package/sqlite-core/query-builders/delete.js +1 -1
  1453. package/sqlite-core/query-builders/delete.js.map +1 -1
  1454. package/sqlite-core/query-builders/insert.cjs +1 -1
  1455. package/sqlite-core/query-builders/insert.cjs.map +1 -1
  1456. package/sqlite-core/query-builders/insert.js +1 -1
  1457. package/sqlite-core/query-builders/insert.js.map +1 -1
  1458. package/sqlite-core/query-builders/query.cjs +13 -5
  1459. package/sqlite-core/query-builders/query.cjs.map +1 -1
  1460. package/sqlite-core/query-builders/query.d.ts +1 -1
  1461. package/sqlite-core/query-builders/query.js +13 -5
  1462. package/sqlite-core/query-builders/query.js.map +1 -1
  1463. package/sqlite-core/query-builders/raw.cjs +0 -4
  1464. package/sqlite-core/query-builders/raw.cjs.map +1 -1
  1465. package/sqlite-core/query-builders/raw.js +0 -4
  1466. package/sqlite-core/query-builders/raw.js.map +1 -1
  1467. package/sqlite-core/query-builders/select.cjs +5 -1
  1468. package/sqlite-core/query-builders/select.cjs.map +1 -1
  1469. package/sqlite-core/query-builders/select.js +5 -1
  1470. package/sqlite-core/query-builders/select.js.map +1 -1
  1471. package/sqlite-core/query-builders/update.cjs +1 -1
  1472. package/sqlite-core/query-builders/update.cjs.map +1 -1
  1473. package/sqlite-core/query-builders/update.js +1 -1
  1474. package/sqlite-core/query-builders/update.js.map +1 -1
  1475. package/sqlite-core/session.cjs +8 -8
  1476. package/sqlite-core/session.cjs.map +1 -1
  1477. package/sqlite-core/session.d.cts +5 -5
  1478. package/sqlite-core/session.d.ts +5 -5
  1479. package/sqlite-core/session.js +8 -8
  1480. package/sqlite-core/session.js.map +1 -1
  1481. package/sqlite-core/table.cjs +1 -1
  1482. package/sqlite-core/table.cjs.map +1 -1
  1483. package/sqlite-core/table.js +1 -1
  1484. package/sqlite-core/table.js.map +1 -1
  1485. package/sqlite-proxy/driver.cjs +3 -2
  1486. package/sqlite-proxy/driver.cjs.map +1 -1
  1487. package/sqlite-proxy/driver.d.ts +1 -1
  1488. package/sqlite-proxy/driver.js +3 -2
  1489. package/sqlite-proxy/driver.js.map +1 -1
  1490. package/sqlite-proxy/session.cjs +19 -16
  1491. package/sqlite-proxy/session.cjs.map +1 -1
  1492. package/sqlite-proxy/session.d.cts +11 -7
  1493. package/sqlite-proxy/session.d.ts +11 -7
  1494. package/sqlite-proxy/session.js +20 -17
  1495. package/sqlite-proxy/session.js.map +1 -1
  1496. package/table.d.cts +1 -1
  1497. package/table.d.ts +1 -1
  1498. package/tidb-serverless/driver.cjs +3 -2
  1499. package/tidb-serverless/driver.cjs.map +1 -1
  1500. package/tidb-serverless/driver.d.cts +1 -0
  1501. package/tidb-serverless/driver.d.ts +1 -0
  1502. package/tidb-serverless/driver.js +3 -2
  1503. package/tidb-serverless/driver.js.map +1 -1
  1504. package/tidb-serverless/session.cjs +24 -36
  1505. package/tidb-serverless/session.cjs.map +1 -1
  1506. package/tidb-serverless/session.d.cts +10 -4
  1507. package/tidb-serverless/session.d.ts +11 -5
  1508. package/tidb-serverless/session.js +25 -37
  1509. package/tidb-serverless/session.js.map +1 -1
  1510. package/tursodatabase/driver-core.cjs +3 -2
  1511. package/tursodatabase/driver-core.cjs.map +1 -1
  1512. package/tursodatabase/driver-core.d.ts +1 -1
  1513. package/tursodatabase/driver-core.js +3 -2
  1514. package/tursodatabase/driver-core.js.map +1 -1
  1515. package/tursodatabase/session.cjs +19 -18
  1516. package/tursodatabase/session.cjs.map +1 -1
  1517. package/tursodatabase/session.d.cts +9 -6
  1518. package/tursodatabase/session.d.ts +9 -6
  1519. package/tursodatabase/session.js +20 -19
  1520. package/tursodatabase/session.js.map +1 -1
  1521. package/up-migrations/effect-pg.cjs +3 -3
  1522. package/up-migrations/effect-pg.cjs.map +1 -1
  1523. package/up-migrations/effect-pg.js +3 -3
  1524. package/up-migrations/effect-pg.js.map +1 -1
  1525. package/up-migrations/pg.cjs +3 -8
  1526. package/up-migrations/pg.cjs.map +1 -1
  1527. package/up-migrations/pg.d.cts +1 -1
  1528. package/up-migrations/pg.d.ts +1 -1
  1529. package/up-migrations/pg.js +3 -8
  1530. package/up-migrations/pg.js.map +1 -1
  1531. package/up-migrations/sqlite.d.ts +2 -2
  1532. package/utils.cjs +128 -6
  1533. package/utils.cjs.map +1 -1
  1534. package/utils.d.cts +10 -3
  1535. package/utils.d.ts +10 -3
  1536. package/utils.js +126 -7
  1537. package/utils.js.map +1 -1
  1538. package/vercel-postgres/driver.cjs +14 -32
  1539. package/vercel-postgres/driver.cjs.map +1 -1
  1540. package/vercel-postgres/driver.d.cts +12 -17
  1541. package/vercel-postgres/driver.d.ts +13 -18
  1542. package/vercel-postgres/driver.js +14 -31
  1543. package/vercel-postgres/driver.js.map +1 -1
  1544. package/vercel-postgres/index.cjs +2 -3
  1545. package/vercel-postgres/index.d.cts +3 -3
  1546. package/vercel-postgres/index.d.ts +3 -3
  1547. package/vercel-postgres/index.js +3 -3
  1548. package/vercel-postgres/migrator.cjs.map +1 -1
  1549. package/vercel-postgres/migrator.d.cts +1 -1
  1550. package/vercel-postgres/migrator.d.ts +1 -1
  1551. package/vercel-postgres/migrator.js.map +1 -1
  1552. package/vercel-postgres/session.cjs +32 -110
  1553. package/vercel-postgres/session.cjs.map +1 -1
  1554. package/vercel-postgres/session.d.cts +9 -32
  1555. package/vercel-postgres/session.d.ts +9 -32
  1556. package/vercel-postgres/session.js +34 -111
  1557. package/vercel-postgres/session.js.map +1 -1
  1558. package/xata-http/driver.cjs +91 -31
  1559. package/xata-http/driver.cjs.map +1 -1
  1560. package/xata-http/driver.d.cts +10 -16
  1561. package/xata-http/driver.d.ts +11 -17
  1562. package/xata-http/driver.js +91 -30
  1563. package/xata-http/driver.js.map +1 -1
  1564. package/xata-http/index.cjs +2 -4
  1565. package/xata-http/index.d.cts +3 -3
  1566. package/xata-http/index.d.ts +3 -3
  1567. package/xata-http/index.js +3 -3
  1568. package/xata-http/migrator.cjs +1 -1
  1569. package/xata-http/migrator.cjs.map +1 -1
  1570. package/xata-http/migrator.d.cts +1 -1
  1571. package/xata-http/migrator.d.ts +1 -1
  1572. package/xata-http/migrator.js +1 -1
  1573. package/xata-http/migrator.js.map +1 -1
  1574. package/xata-http/session.cjs +23 -109
  1575. package/xata-http/session.cjs.map +1 -1
  1576. package/xata-http/session.d.cts +7 -33
  1577. package/xata-http/session.d.ts +6 -32
  1578. package/xata-http/session.js +25 -109
  1579. package/xata-http/session.js.map +1 -1
  1580. package/pg-core/query-builders/_query.cjs +0 -101
  1581. package/pg-core/query-builders/_query.cjs.map +0 -1
  1582. package/pg-core/query-builders/_query.d.cts +0 -55
  1583. package/pg-core/query-builders/_query.d.ts +0 -55
  1584. package/pg-core/query-builders/_query.js +0 -97
  1585. package/pg-core/query-builders/_query.js.map +0 -1
  1586. package/pg-core/utils/array.cjs.map +0 -1
  1587. package/pg-core/utils/array.js.map +0 -1
  1588. package/pg-core/utils/index.cjs +0 -6
  1589. package/pg-core/utils/index.d.cts +0 -2
  1590. package/pg-core/utils/index.d.ts +0 -2
  1591. package/pg-core/utils/index.js +0 -3
@@ -7,10 +7,10 @@ let __view_common_ts = require("../../view-common.cjs");
7
7
  let __table_ts = require("../../table.cjs");
8
8
  let __utils_ts = require("../../utils.cjs");
9
9
  let __sql_sql_ts = require("../../sql/sql.cjs");
10
+ let __query_name_generator_ts = require("../../query-name-generator.cjs");
10
11
  let __selection_proxy_ts = require("../../selection-proxy.cjs");
11
12
  let __query_promise_ts = require("../../query-promise.cjs");
12
13
  let __query_builders_query_builder_ts = require("../../query-builders/query-builder.cjs");
13
- let __query_name_generator_ts = require("../../query-name-generator.cjs");
14
14
  let __cockroach_core_view_base_ts = require("../view-base.cjs");
15
15
 
16
16
  //#region src/cockroach-core/query-builders/select.ts
@@ -678,6 +678,10 @@ var CockroachSelectQueryBuilderBase = class extends __query_builders_query_build
678
678
  sqlBehavior: "error"
679
679
  }));
680
680
  }
681
+ /** @internal */
682
+ withoutSelectionCastCodecs() {
683
+ return this;
684
+ }
681
685
  $dynamic() {
682
686
  return this;
683
687
  }
@@ -691,7 +695,7 @@ var CockroachSelectBase = class extends CockroachSelectQueryBuilderBase {
691
695
  return __tracing_ts.tracer.startActiveSpan("drizzle.prepareQuery", () => {
692
696
  const fieldsList = (0, __utils_ts.orderSelectedFields)(config.fields);
693
697
  const query = dialect.sqlToQuery(this.getSQL());
694
- const preparedQuery = session.prepareQuery(query, fieldsList, name ?? (generateName ? (0, __query_name_generator_ts.preparedStatementName)(query.sql, query.params) : name), true);
698
+ const preparedQuery = session.prepareQuery(query, fieldsList, name ?? (generateName ? (0, __query_name_generator_ts.preparedStatementName)(query.sql, query.params) : name));
695
699
  preparedQuery.joinsNotNullableMap = joinsNotNullableMap;
696
700
  return preparedQuery;
697
701
  });
@@ -1 +1 @@
1
- {"version":3,"file":"select.cjs","names":["entityKind","Subquery","CockroachViewBase","ViewBaseConfig","SQL","TypedQueryBuilder","View","Table","SelectionProxyHandler","tracer","QueryPromise"],"sources":["../../../src/cockroach-core/query-builders/select.ts"],"sourcesContent":["import type { CockroachColumn } from '~/cockroach-core/columns/index.ts';\nimport type { CockroachDialect } from '~/cockroach-core/dialect.ts';\nimport type { CockroachSession, PreparedQueryConfig } from '~/cockroach-core/session.ts';\nimport type { SubqueryWithSelection } from '~/cockroach-core/subquery.ts';\nimport type { CockroachTable } from '~/cockroach-core/table.ts';\nimport { CockroachViewBase } from '~/cockroach-core/view-base.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tGetSelectTableSelection,\n\tJoinNullability,\n\tJoinType,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport { preparedStatementName } from '~/query-name-generator.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { SQL, View } from '~/sql/sql.ts';\nimport type { ColumnsSelection, Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport { Subquery } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport { tracer } from '~/tracing.ts';\nimport {\n\tapplyMixins,\n\ttype DrizzleTypeError,\n\tgetTableColumns,\n\tgetTableLikeName,\n\thaveSameKeys,\n\torderSelectedFields,\n\ttype ValueOrArray,\n} from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type {\n\tAnyCockroachSelect,\n\tCockroachCreateSetOperatorFn,\n\tCockroachSelectConfig,\n\tCockroachSelectCrossJoinFn,\n\tCockroachSelectDynamic,\n\tCockroachSelectHKT,\n\tCockroachSelectHKTBase,\n\tCockroachSelectJoinFn,\n\tCockroachSelectPrepare,\n\tCockroachSelectWithout,\n\tCockroachSetOperatorExcludedMethods,\n\tCockroachSetOperatorWithResult,\n\tCreateCockroachSelectFromBuilderMode,\n\tGetCockroachSetOperators,\n\tLockConfig,\n\tLockStrength,\n\tSelectedFields,\n\tSetOperatorRightSelect,\n\tTableLikeHasEmptySelection,\n} from './select.types.ts';\n\nexport class CockroachSelectBuilder<\n\tTSelection extends SelectedFields | undefined,\n\tTBuilderMode extends 'db' | 'qb' = 'db',\n> {\n\tstatic readonly [entityKind]: string = 'CockroachSelectBuilder';\n\n\tprivate fields: TSelection;\n\tprivate session: CockroachSession | undefined;\n\tprivate dialect: CockroachDialect;\n\tprivate withList: Subquery[] = [];\n\tprivate distinct: boolean | {\n\t\ton: (CockroachColumn | SQLWrapper)[];\n\t} | undefined;\n\n\tconstructor(\n\t\tconfig: {\n\t\t\tfields: TSelection;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList?: Subquery[];\n\t\t\tdistinct?: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t};\n\t\t},\n\t) {\n\t\tthis.fields = config.fields;\n\t\tthis.session = config.session;\n\t\tthis.dialect = config.dialect;\n\t\tif (config.withList) {\n\t\t\tthis.withList = config.withList;\n\t\t}\n\t\tthis.distinct = config.distinct;\n\t}\n\n\t/**\n\t * Specify the table, subquery, or other target that you're\n\t * building a select query against.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM | Postgres from documentation}\n\t */\n\tfrom<TFrom extends CockroachTable | Subquery | CockroachViewBase | SQL>(\n\t\tsource: TableLikeHasEmptySelection<TFrom> extends true ? DrizzleTypeError<\n\t\t\t\t\"Cannot reference a data-modifying statement subquery if it doesn't contain a `returning` clause\"\n\t\t\t>\n\t\t\t: TFrom,\n\t): CreateCockroachSelectFromBuilderMode<\n\t\tTBuilderMode,\n\t\tGetSelectTableName<TFrom>,\n\t\tTSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection,\n\t\tTSelection extends undefined ? 'single' : 'partial'\n\t> {\n\t\tconst isPartialSelect = !!this.fields;\n\t\tconst src = source as TFrom;\n\n\t\tlet fields: SelectedFields;\n\t\tif (this.fields) {\n\t\t\tfields = this.fields;\n\t\t} else if (is(src, Subquery)) {\n\t\t\t// This is required to use the proxy handler to get the correct field values from the subquery\n\t\t\tfields = Object.fromEntries(\n\t\t\t\tObject.keys(src._.selectedFields).map((\n\t\t\t\t\tkey,\n\t\t\t\t) => [key, src[key as unknown as keyof typeof src] as unknown as SelectedFields[string]]),\n\t\t\t);\n\t\t} else if (is(src, CockroachViewBase)) {\n\t\t\tfields = src[ViewBaseConfig].selectedFields as SelectedFields;\n\t\t} else if (is(src, SQL)) {\n\t\t\tfields = {};\n\t\t} else {\n\t\t\tfields = getTableColumns<CockroachTable>(src);\n\t\t}\n\n\t\treturn (new CockroachSelectBase({\n\t\t\ttable: src,\n\t\t\tfields,\n\t\t\tisPartialSelect,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\twithList: this.withList,\n\t\t\tdistinct: this.distinct,\n\t\t}));\n\t}\n}\n\nexport abstract class CockroachSelectQueryBuilderBase<\n\tTHKT extends CockroachSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends TypedQueryBuilder<TSelectedFields, TResult> {\n\tstatic override readonly [entityKind]: string = 'CockroachSelectQueryBuilder';\n\n\toverride readonly _: {\n\t\treadonly dialect: 'cockroach';\n\t\treadonly hkt: THKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n\n\tprotected config: CockroachSelectConfig;\n\tprotected joinsNotNullableMap: Record<string, boolean>;\n\tprivate tableName: string | undefined;\n\tprivate isPartialSelect: boolean;\n\tprotected session: CockroachSession | undefined;\n\tprotected dialect: CockroachDialect;\n\n\tconstructor(\n\t\t{ table, fields, isPartialSelect, session, dialect, withList, distinct }: {\n\t\t\ttable: CockroachSelectConfig['table'];\n\t\t\tfields: CockroachSelectConfig['fields'];\n\t\t\tisPartialSelect: boolean;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList: Subquery[];\n\t\t\tdistinct: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t} | undefined;\n\t\t},\n\t) {\n\t\tsuper();\n\t\tthis.config = {\n\t\t\twithList,\n\t\t\ttable,\n\t\t\tfields: { ...fields },\n\t\t\tdistinct,\n\t\t\tsetOperators: [],\n\t\t};\n\t\tthis.isPartialSelect = isPartialSelect;\n\t\tthis.session = session;\n\t\tthis.dialect = dialect;\n\t\tthis._ = {\n\t\t\tselectedFields: fields as TSelectedFields,\n\t\t} as this['_'];\n\t\tthis.tableName = getTableLikeName(table);\n\t\tthis.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};\n\t}\n\n\tprivate createJoin<\n\t\tTJoinType extends JoinType,\n\t\tTIsLateral extends (TJoinType extends 'full' | 'right' ? false : boolean),\n\t>(\n\t\tjoinType: TJoinType,\n\t\tlateral: TIsLateral,\n\t): 'cross' extends TJoinType ? CockroachSelectCrossJoinFn<this, TDynamic, TIsLateral>\n\t\t: CockroachSelectJoinFn<this, TDynamic, TJoinType, TIsLateral>\n\t{\n\t\treturn ((\n\t\t\ttable: TIsLateral extends true ? Subquery | SQL : CockroachTable | Subquery | CockroachViewBase | SQL,\n\t\t\ton?: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t\t) => {\n\t\t\tconst baseTableName = this.tableName;\n\t\t\tconst tableName = getTableLikeName(table);\n\n\t\t\tif (typeof tableName === 'string' && this.config.joins?.some((join) => join.alias === tableName)) {\n\t\t\t\tthrow new Error(`Alias \"${tableName}\" is already used in this query`);\n\t\t\t}\n\n\t\t\tif (!this.isPartialSelect) {\n\t\t\t\t// If this is the first join and this is not a partial select and we're not selecting from raw SQL, \"move\" the fields from the main table to the nested object\n\t\t\t\tif (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === 'string') {\n\t\t\t\t\tthis.config.fields = {\n\t\t\t\t\t\t[baseTableName]: this.config.fields,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (typeof tableName === 'string' && !is(table, SQL)) {\n\t\t\t\t\tconst selection = is(table, Subquery)\n\t\t\t\t\t\t? table._.selectedFields\n\t\t\t\t\t\t: is(table, View)\n\t\t\t\t\t\t? table[ViewBaseConfig].selectedFields\n\t\t\t\t\t\t: table[Table.Symbol.Columns];\n\t\t\t\t\tthis.config.fields[tableName] = selection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof on === 'function') {\n\t\t\t\ton = on(\n\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\tthis.config.fields,\n\t\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t\t) as TSelection,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!this.config.joins) {\n\t\t\t\tthis.config.joins = [];\n\t\t\t}\n\n\t\t\tthis.config.joins.push({ on, table, joinType, alias: tableName, lateral });\n\n\t\t\tif (typeof tableName === 'string') {\n\t\t\t\tswitch (joinType) {\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'right': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'cross':\n\t\t\t\t\tcase 'inner': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'full': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this as any;\n\t\t}) as any;\n\t}\n\n\t/**\n\t * Executes a `left join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tleftJoin = this.createJoin('left', false);\n\n\t/**\n\t * Executes a `left join lateral` operation by adding subquery to the current query.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tleftJoinLateral = this.createJoin('left', true);\n\n\t/**\n\t * Executes a `right join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\trightJoin = this.createJoin('right', false);\n\n\t/**\n\t * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tinnerJoin = this.createJoin('inner', false);\n\n\t/**\n\t * Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tinnerJoinLateral = this.createJoin('inner', true);\n\n\t/**\n\t * Executes a `full join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tfullJoin = this.createJoin('full', false);\n\n\t/**\n\t * Executes a `cross join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}\n\t *\n\t * @param table the table to join.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users, each user with every pet\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .crossJoin(pets)\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .crossJoin(pets)\n\t * ```\n\t */\n\tcrossJoin = this.createJoin('cross', false);\n\n\t/**\n\t * Executes a `cross join lateral` operation by combining rows from two queries into a new table.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}\n\t *\n\t * @param table the query to join.\n\t */\n\tcrossJoinLateral = this.createJoin('cross', true);\n\n\tprivate createSetOperator(\n\t\ttype: SetOperator,\n\t\tisAll: boolean,\n\t): <TValue extends CockroachSetOperatorWithResult<TResult>>(\n\t\trightSelection:\n\t\t\t| ((setOperators: GetCockroachSetOperators) => SetOperatorRightSelect<TValue, TResult>)\n\t\t\t| SetOperatorRightSelect<TValue, TResult>,\n\t) => CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\treturn (rightSelection) => {\n\t\t\tconst rightSelect = (typeof rightSelection === 'function'\n\t\t\t\t? rightSelection(getCockroachSetOperators())\n\t\t\t\t: rightSelection) as TypedQueryBuilder<\n\t\t\t\t\tany,\n\t\t\t\t\tTResult\n\t\t\t\t>;\n\n\t\t\tif (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.config.setOperators.push({ type, isAll, rightSelect });\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Adds `union` set operator to the query.\n\t *\n\t * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique names from customers and users tables\n\t * await db.select({ name: users.name })\n\t * .from(users)\n\t * .union(\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * // or\n\t * import { union } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await union(\n\t * db.select({ name: users.name }).from(users),\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * ```\n\t */\n\tunion = this.createSetOperator('union', false);\n\n\t/**\n\t * Adds `union all` set operator to the query.\n\t *\n\t * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all transaction ids from both online and in-store sales\n\t * await db.select({ transaction: onlineSales.transactionId })\n\t * .from(onlineSales)\n\t * .unionAll(\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * // or\n\t * import { unionAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await unionAll(\n\t * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * ```\n\t */\n\tunionAll = this.createSetOperator('union', true);\n\n\t/**\n\t * Adds `intersect` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select course names that are offered in both departments A and B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .intersect(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { intersect } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersect(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\tintersect = this.createSetOperator('intersect', false);\n\n\t/**\n\t * Adds `intersect all` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products and quantities that are ordered by both regular and VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .intersectAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { intersectAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersectAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\tintersectAll = this.createSetOperator('intersect', true);\n\n\t/**\n\t * Adds `except` set operator to the query.\n\t *\n\t * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all courses offered in department A but not in department B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .except(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { except } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await except(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\texcept = this.createSetOperator('except', false);\n\n\t/**\n\t * Adds `except all` set operator to the query.\n\t *\n\t * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products that are ordered by regular customers but not by VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .exceptAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { exceptAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await exceptAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\texceptAll = this.createSetOperator('except', true);\n\n\t/** @internal */\n\taddSetOperators(setOperators: CockroachSelectConfig['setOperators']): CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\tthis.config.setOperators.push(...setOperators);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#filtering}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be selected.\n\t *\n\t * ```ts\n\t * // Select all cars with green color\n\t * await db.select().from(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * await db.select().from(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Select all BMW cars with a green color\n\t * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Select all cars with the green or blue color\n\t * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(\n\t\twhere: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'where'> {\n\t\tif (typeof where === 'function') {\n\t\t\twhere = where(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `having` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @param having the `having` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all brands with more than one car\n\t * await db.select({\n\t * \tbrand: cars.brand,\n\t * \tcount: sql<number>`cast(count(${cars.id}) as int)`,\n\t * })\n\t * .from(cars)\n\t * .groupBy(cars.brand)\n\t * .having(({ count }) => gt(count, 1));\n\t * ```\n\t */\n\thaving(\n\t\thaving: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'having'> {\n\t\tif (typeof having === 'function') {\n\t\t\thaving = having(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.having = having;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `group by` clause to the query.\n\t *\n\t * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Group and count people by their last names\n\t * await db.select({\n\t * lastName: people.lastName,\n\t * count: sql<number>`cast(count(*) as int)`\n\t * })\n\t * .from(people)\n\t * .groupBy(people.lastName);\n\t * ```\n\t */\n\tgroupBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst groupBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t\tthis.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];\n\t\t} else {\n\t\t\tthis.config.groupBy = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `order by` clause to the query.\n\t *\n\t * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#order-by}\n\t *\n\t * @example\n\t *\n\t * ```\n\t * // Select cars ordered by year\n\t * await db.select().from(cars).orderBy(cars.year);\n\t * ```\n\t *\n\t * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.\n\t *\n\t * ```ts\n\t * // Select cars ordered by year in descending order\n\t * await db.select().from(cars).orderBy(desc(cars.year));\n\t *\n\t * // Select cars ordered by year and price\n\t * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));\n\t * ```\n\t */\n\torderBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst orderBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\n\t\t\tconst orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t} else {\n\t\t\tconst orderByArray = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `limit` clause to the query.\n\t *\n\t * Calling this method will set the maximum number of rows that will be returned by this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param limit the `limit` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the first 10 people from this query.\n\t * await db.select().from(people).limit(10);\n\t * ```\n\t */\n\tlimit(limit: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'limit'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.limit = limit;\n\t\t} else {\n\t\t\tthis.config.limit = limit;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `offset` clause to the query.\n\t *\n\t * Calling this method will skip a number of rows when returning results from this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param offset the `offset` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the 10th-20th people from this query.\n\t * await db.select().from(people).offset(10).limit(10);\n\t * ```\n\t */\n\toffset(offset: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'offset'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.offset = offset;\n\t\t} else {\n\t\t\tthis.config.offset = offset;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `for` clause to the query.\n\t *\n\t * Calling this method will specify a lock strength for this query that controls how strictly it acquires exclusive access to the rows being queried.\n\t *\n\t * See docs: {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE}\n\t *\n\t * @param strength the lock strength.\n\t * @param config the lock configuration.\n\t */\n\tfor(strength: LockStrength, config: LockConfig = {}): CockroachSelectWithout<this, TDynamic, 'for'> {\n\t\tthis.config.lockingClause = { strength, config };\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildSelectQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tas<TAlias extends string>(\n\t\talias: TAlias,\n\t): SubqueryWithSelection<this['_']['selectedFields'], TAlias> {\n\t\treturn new Proxy(\n\t\t\tnew Subquery(this.getSQL(), this.config.fields, alias),\n\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as SubqueryWithSelection<this['_']['selectedFields'], TAlias>;\n\t}\n\n\t/** @internal */\n\toverride getSelectedFields(): this['_']['selectedFields'] {\n\t\treturn new Proxy(\n\t\t\tthis.config.fields,\n\t\t\tnew SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as this['_']['selectedFields'];\n\t}\n\n\t$dynamic(): CockroachSelectDynamic<this> {\n\t\treturn this;\n\t}\n}\n\nexport interface CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends\n\tCockroachSelectQueryBuilderBase<\n\t\tCockroachSelectHKT,\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tQueryPromise<TResult>,\n\tSQLWrapper\n{}\n\nexport class CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends CockroachSelectQueryBuilderBase<\n\tCockroachSelectHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTNullabilityMap,\n\tTDynamic,\n\tTExcludedMethods,\n\tTResult,\n\tTSelectedFields\n> implements RunnableQuery<TResult, 'cockroach'>, SQLWrapper {\n\tstatic override readonly [entityKind]: string = 'CockroachSelect';\n\n\t/** @internal */\n\t_prepare(name?: string, generateName = false): CockroachSelectPrepare<this> {\n\t\tconst { session, config, dialect, joinsNotNullableMap } = this;\n\t\tif (!session) {\n\t\t\tthrow new Error('Cannot execute a query on a query builder. Please use a database instance instead.');\n\t\t}\n\t\treturn tracer.startActiveSpan('drizzle.prepareQuery', () => {\n\t\t\tconst fieldsList = orderSelectedFields<CockroachColumn>(config.fields);\n\t\t\tconst query = dialect.sqlToQuery(this.getSQL());\n\t\t\tconst preparedQuery = session.prepareQuery<\n\t\t\t\tPreparedQueryConfig & { execute: TResult }\n\t\t\t>(\n\t\t\t\tquery,\n\t\t\t\tfieldsList,\n\t\t\t\tname ?? (generateName ? preparedStatementName(query.sql, query.params) : name),\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\tpreparedQuery.joinsNotNullableMap = joinsNotNullableMap;\n\n\t\t\treturn preparedQuery;\n\t\t});\n\t}\n\n\t/**\n\t * Create a prepared statement for this query. This allows\n\t * the database to remember this query for the given session\n\t * and call it by name, rather than specifying the full query.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-prepare.html | Postgres prepare documentation}\n\t */\n\tprepare(name?: string): CockroachSelectPrepare<this> {\n\t\treturn this._prepare(name, true);\n\t}\n\n\texecute: ReturnType<this['prepare']>['execute'] = (placeholderValues) => {\n\t\treturn tracer.startActiveSpan('drizzle.operation', () => {\n\t\t\treturn this._prepare().execute(placeholderValues);\n\t\t});\n\t};\n}\n\napplyMixins(CockroachSelectBase, [QueryPromise]);\n\nfunction createSetOperator(type: SetOperator, isAll: boolean): CockroachCreateSetOperatorFn {\n\treturn (leftSelect, rightSelect, ...restSelects) => {\n\t\tconst setOperators = [rightSelect, ...restSelects].map((select) => ({\n\t\t\ttype,\n\t\t\tisAll,\n\t\t\trightSelect: select as AnyCockroachSelect,\n\t\t}));\n\n\t\tfor (const setOperator of setOperators) {\n\t\t\tif (!haveSameKeys((leftSelect as any).getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn (leftSelect as AnyCockroachSelect).addSetOperators(setOperators) as any;\n\t};\n}\n\nconst getCockroachSetOperators = () => ({\n\tunion,\n\tunionAll,\n\tintersect,\n\tintersectAll,\n\texcept,\n\texceptAll,\n});\n\n/**\n * Adds `union` set operator to the query.\n *\n * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n *\n * @example\n *\n * ```ts\n * // Select all unique names from customers and users tables\n * import { union } from 'drizzle-orm/cockroach-core'\n *\n * await union(\n * db.select({ name: users.name }).from(users),\n * db.select({ name: customers.name }).from(customers)\n * );\n * // or\n * await db.select({ name: users.name })\n * .from(users)\n * .union(\n * db.select({ name: customers.name }).from(customers)\n * );\n * ```\n */\nexport const union = createSetOperator('union', false);\n\n/**\n * Adds `union all` set operator to the query.\n *\n * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n *\n * @example\n *\n * ```ts\n * // Select all transaction ids from both online and in-store sales\n * import { unionAll } from 'drizzle-orm/cockroach-core'\n *\n * await unionAll(\n * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * // or\n * await db.select({ transaction: onlineSales.transactionId })\n * .from(onlineSales)\n * .unionAll(\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * ```\n */\nexport const unionAll = createSetOperator('union', true);\n\n/**\n * Adds `intersect` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n *\n * @example\n *\n * ```ts\n * // Select course names that are offered in both departments A and B\n * import { intersect } from 'drizzle-orm/cockroach-core'\n *\n * await intersect(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .intersect(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const intersect = createSetOperator('intersect', false);\n\n/**\n * Adds `intersect all` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n *\n * @example\n *\n * ```ts\n * // Select all products and quantities that are ordered by both regular and VIP customers\n * import { intersectAll } from 'drizzle-orm/cockroach-core'\n *\n * await intersectAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders)\n * .intersectAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const intersectAll = createSetOperator('intersect', true);\n\n/**\n * Adds `except` set operator to the query.\n *\n * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n *\n * @example\n *\n * ```ts\n * // Select all courses offered in department A but not in department B\n * import { except } from 'drizzle-orm/cockroach-core'\n *\n * await except(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .except(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const except = createSetOperator('except', false);\n\n/**\n * Adds `except all` set operator to the query.\n *\n * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n *\n * @example\n *\n * ```ts\n * // Select all products that are ordered by regular customers but not by VIP customers\n * import { exceptAll } from 'drizzle-orm/cockroach-core'\n *\n * await exceptAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered,\n * })\n * .from(regularCustomerOrders)\n * .exceptAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered,\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const exceptAll = createSetOperator('except', true);\n"],"mappings":";;;;;;;;;;;;;;;;AA2DA,IAAa,yBAAb,MAGE;CACD,QAAiBA,0BAAsB;CAEvC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,WAAuB,EAAE;CACjC,AAAQ;CAIR,YACC,QASC;AACD,OAAK,SAAS,OAAO;AACrB,OAAK,UAAU,OAAO;AACtB,OAAK,UAAU,OAAO;AACtB,MAAI,OAAO,SACV,MAAK,WAAW,OAAO;AAExB,OAAK,WAAW,OAAO;;;;;;;;CASxB,KACC,QASC;EACD,MAAM,kBAAkB,CAAC,CAAC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names":["entityKind","Subquery","CockroachViewBase","ViewBaseConfig","SQL","TypedQueryBuilder","View","Table","SelectionProxyHandler","tracer","QueryPromise"],"sources":["../../../src/cockroach-core/query-builders/select.ts"],"sourcesContent":["import type { CockroachColumn } from '~/cockroach-core/columns/index.ts';\nimport type { CockroachDialect } from '~/cockroach-core/dialect.ts';\nimport type { CockroachSession, PreparedQueryConfig } from '~/cockroach-core/session.ts';\nimport type { SubqueryWithSelection } from '~/cockroach-core/subquery.ts';\nimport type { CockroachTable } from '~/cockroach-core/table.ts';\nimport { CockroachViewBase } from '~/cockroach-core/view-base.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tGetSelectTableSelection,\n\tJoinNullability,\n\tJoinType,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport { preparedStatementName } from '~/query-name-generator.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { SQL, View } from '~/sql/sql.ts';\nimport type { ColumnsSelection, Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport { Subquery } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport { tracer } from '~/tracing.ts';\nimport {\n\tapplyMixins,\n\ttype DrizzleTypeError,\n\tgetTableColumns,\n\tgetTableLikeName,\n\thaveSameKeys,\n\torderSelectedFields,\n\ttype ValueOrArray,\n} from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type {\n\tAnyCockroachSelect,\n\tCockroachCreateSetOperatorFn,\n\tCockroachSelectConfig,\n\tCockroachSelectCrossJoinFn,\n\tCockroachSelectDynamic,\n\tCockroachSelectHKT,\n\tCockroachSelectHKTBase,\n\tCockroachSelectJoinFn,\n\tCockroachSelectPrepare,\n\tCockroachSelectWithout,\n\tCockroachSetOperatorExcludedMethods,\n\tCockroachSetOperatorWithResult,\n\tCreateCockroachSelectFromBuilderMode,\n\tGetCockroachSetOperators,\n\tLockConfig,\n\tLockStrength,\n\tSelectedFields,\n\tSetOperatorRightSelect,\n\tTableLikeHasEmptySelection,\n} from './select.types.ts';\n\nexport class CockroachSelectBuilder<\n\tTSelection extends SelectedFields | undefined,\n\tTBuilderMode extends 'db' | 'qb' = 'db',\n> {\n\tstatic readonly [entityKind]: string = 'CockroachSelectBuilder';\n\n\tprivate fields: TSelection;\n\tprivate session: CockroachSession | undefined;\n\tprivate dialect: CockroachDialect;\n\tprivate withList: Subquery[] = [];\n\tprivate distinct: boolean | {\n\t\ton: (CockroachColumn | SQLWrapper)[];\n\t} | undefined;\n\n\tconstructor(\n\t\tconfig: {\n\t\t\tfields: TSelection;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList?: Subquery[];\n\t\t\tdistinct?: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t};\n\t\t},\n\t) {\n\t\tthis.fields = config.fields;\n\t\tthis.session = config.session;\n\t\tthis.dialect = config.dialect;\n\t\tif (config.withList) {\n\t\t\tthis.withList = config.withList;\n\t\t}\n\t\tthis.distinct = config.distinct;\n\t}\n\n\t/**\n\t * Specify the table, subquery, or other target that you're\n\t * building a select query against.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM | Postgres from documentation}\n\t */\n\tfrom<TFrom extends CockroachTable | Subquery | CockroachViewBase | SQL>(\n\t\tsource: TableLikeHasEmptySelection<TFrom> extends true ? DrizzleTypeError<\n\t\t\t\t\"Cannot reference a data-modifying statement subquery if it doesn't contain a `returning` clause\"\n\t\t\t>\n\t\t\t: TFrom,\n\t): CreateCockroachSelectFromBuilderMode<\n\t\tTBuilderMode,\n\t\tGetSelectTableName<TFrom>,\n\t\tTSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection,\n\t\tTSelection extends undefined ? 'single' : 'partial'\n\t> {\n\t\tconst isPartialSelect = !!this.fields;\n\t\tconst src = source as TFrom;\n\n\t\tlet fields: SelectedFields;\n\t\tif (this.fields) {\n\t\t\tfields = this.fields;\n\t\t} else if (is(src, Subquery)) {\n\t\t\t// This is required to use the proxy handler to get the correct field values from the subquery\n\t\t\tfields = Object.fromEntries(\n\t\t\t\tObject.keys(src._.selectedFields).map((\n\t\t\t\t\tkey,\n\t\t\t\t) => [key, src[key as unknown as keyof typeof src] as unknown as SelectedFields[string]]),\n\t\t\t);\n\t\t} else if (is(src, CockroachViewBase)) {\n\t\t\tfields = src[ViewBaseConfig].selectedFields as SelectedFields;\n\t\t} else if (is(src, SQL)) {\n\t\t\tfields = {};\n\t\t} else {\n\t\t\tfields = getTableColumns<CockroachTable>(src);\n\t\t}\n\n\t\treturn (new CockroachSelectBase({\n\t\t\ttable: src,\n\t\t\tfields,\n\t\t\tisPartialSelect,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\twithList: this.withList,\n\t\t\tdistinct: this.distinct,\n\t\t}));\n\t}\n}\n\nexport abstract class CockroachSelectQueryBuilderBase<\n\tTHKT extends CockroachSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends TypedQueryBuilder<TSelectedFields, TResult> {\n\tstatic override readonly [entityKind]: string = 'CockroachSelectQueryBuilder';\n\n\toverride readonly _: {\n\t\treadonly dialect: 'cockroach';\n\t\treadonly hkt: THKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n\n\tprotected config: CockroachSelectConfig;\n\tprotected joinsNotNullableMap: Record<string, boolean>;\n\tprivate tableName: string | undefined;\n\tprivate isPartialSelect: boolean;\n\tprotected session: CockroachSession | undefined;\n\tprotected dialect: CockroachDialect;\n\n\tconstructor(\n\t\t{ table, fields, isPartialSelect, session, dialect, withList, distinct }: {\n\t\t\ttable: CockroachSelectConfig['table'];\n\t\t\tfields: CockroachSelectConfig['fields'];\n\t\t\tisPartialSelect: boolean;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList: Subquery[];\n\t\t\tdistinct: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t} | undefined;\n\t\t},\n\t) {\n\t\tsuper();\n\t\tthis.config = {\n\t\t\twithList,\n\t\t\ttable,\n\t\t\tfields: { ...fields },\n\t\t\tdistinct,\n\t\t\tsetOperators: [],\n\t\t};\n\t\tthis.isPartialSelect = isPartialSelect;\n\t\tthis.session = session;\n\t\tthis.dialect = dialect;\n\t\tthis._ = {\n\t\t\tselectedFields: fields as TSelectedFields,\n\t\t} as this['_'];\n\t\tthis.tableName = getTableLikeName(table);\n\t\tthis.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};\n\t}\n\n\tprivate createJoin<\n\t\tTJoinType extends JoinType,\n\t\tTIsLateral extends (TJoinType extends 'full' | 'right' ? false : boolean),\n\t>(\n\t\tjoinType: TJoinType,\n\t\tlateral: TIsLateral,\n\t): 'cross' extends TJoinType ? CockroachSelectCrossJoinFn<this, TDynamic, TIsLateral>\n\t\t: CockroachSelectJoinFn<this, TDynamic, TJoinType, TIsLateral>\n\t{\n\t\treturn ((\n\t\t\ttable: TIsLateral extends true ? Subquery | SQL : CockroachTable | Subquery | CockroachViewBase | SQL,\n\t\t\ton?: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t\t) => {\n\t\t\tconst baseTableName = this.tableName;\n\t\t\tconst tableName = getTableLikeName(table);\n\n\t\t\tif (typeof tableName === 'string' && this.config.joins?.some((join) => join.alias === tableName)) {\n\t\t\t\tthrow new Error(`Alias \"${tableName}\" is already used in this query`);\n\t\t\t}\n\n\t\t\tif (!this.isPartialSelect) {\n\t\t\t\t// If this is the first join and this is not a partial select and we're not selecting from raw SQL, \"move\" the fields from the main table to the nested object\n\t\t\t\tif (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === 'string') {\n\t\t\t\t\tthis.config.fields = {\n\t\t\t\t\t\t[baseTableName]: this.config.fields,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (typeof tableName === 'string' && !is(table, SQL)) {\n\t\t\t\t\tconst selection = is(table, Subquery)\n\t\t\t\t\t\t? table._.selectedFields\n\t\t\t\t\t\t: is(table, View)\n\t\t\t\t\t\t? table[ViewBaseConfig].selectedFields\n\t\t\t\t\t\t: table[Table.Symbol.Columns];\n\t\t\t\t\tthis.config.fields[tableName] = selection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof on === 'function') {\n\t\t\t\ton = on(\n\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\tthis.config.fields,\n\t\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t\t) as TSelection,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!this.config.joins) {\n\t\t\t\tthis.config.joins = [];\n\t\t\t}\n\n\t\t\tthis.config.joins.push({ on, table, joinType, alias: tableName, lateral });\n\n\t\t\tif (typeof tableName === 'string') {\n\t\t\t\tswitch (joinType) {\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'right': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'cross':\n\t\t\t\t\tcase 'inner': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'full': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this as any;\n\t\t}) as any;\n\t}\n\n\t/**\n\t * Executes a `left join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tleftJoin = this.createJoin('left', false);\n\n\t/**\n\t * Executes a `left join lateral` operation by adding subquery to the current query.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tleftJoinLateral = this.createJoin('left', true);\n\n\t/**\n\t * Executes a `right join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\trightJoin = this.createJoin('right', false);\n\n\t/**\n\t * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tinnerJoin = this.createJoin('inner', false);\n\n\t/**\n\t * Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tinnerJoinLateral = this.createJoin('inner', true);\n\n\t/**\n\t * Executes a `full join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tfullJoin = this.createJoin('full', false);\n\n\t/**\n\t * Executes a `cross join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}\n\t *\n\t * @param table the table to join.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users, each user with every pet\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .crossJoin(pets)\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .crossJoin(pets)\n\t * ```\n\t */\n\tcrossJoin = this.createJoin('cross', false);\n\n\t/**\n\t * Executes a `cross join lateral` operation by combining rows from two queries into a new table.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}\n\t *\n\t * @param table the query to join.\n\t */\n\tcrossJoinLateral = this.createJoin('cross', true);\n\n\tprivate createSetOperator(\n\t\ttype: SetOperator,\n\t\tisAll: boolean,\n\t): <TValue extends CockroachSetOperatorWithResult<TResult>>(\n\t\trightSelection:\n\t\t\t| ((setOperators: GetCockroachSetOperators) => SetOperatorRightSelect<TValue, TResult>)\n\t\t\t| SetOperatorRightSelect<TValue, TResult>,\n\t) => CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\treturn (rightSelection) => {\n\t\t\tconst rightSelect = (typeof rightSelection === 'function'\n\t\t\t\t? rightSelection(getCockroachSetOperators())\n\t\t\t\t: rightSelection) as TypedQueryBuilder<\n\t\t\t\t\tany,\n\t\t\t\t\tTResult\n\t\t\t\t>;\n\n\t\t\tif (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.config.setOperators.push({ type, isAll, rightSelect });\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Adds `union` set operator to the query.\n\t *\n\t * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique names from customers and users tables\n\t * await db.select({ name: users.name })\n\t * .from(users)\n\t * .union(\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * // or\n\t * import { union } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await union(\n\t * db.select({ name: users.name }).from(users),\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * ```\n\t */\n\tunion = this.createSetOperator('union', false);\n\n\t/**\n\t * Adds `union all` set operator to the query.\n\t *\n\t * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all transaction ids from both online and in-store sales\n\t * await db.select({ transaction: onlineSales.transactionId })\n\t * .from(onlineSales)\n\t * .unionAll(\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * // or\n\t * import { unionAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await unionAll(\n\t * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * ```\n\t */\n\tunionAll = this.createSetOperator('union', true);\n\n\t/**\n\t * Adds `intersect` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select course names that are offered in both departments A and B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .intersect(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { intersect } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersect(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\tintersect = this.createSetOperator('intersect', false);\n\n\t/**\n\t * Adds `intersect all` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products and quantities that are ordered by both regular and VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .intersectAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { intersectAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersectAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\tintersectAll = this.createSetOperator('intersect', true);\n\n\t/**\n\t * Adds `except` set operator to the query.\n\t *\n\t * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all courses offered in department A but not in department B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .except(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { except } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await except(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\texcept = this.createSetOperator('except', false);\n\n\t/**\n\t * Adds `except all` set operator to the query.\n\t *\n\t * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products that are ordered by regular customers but not by VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .exceptAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { exceptAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await exceptAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\texceptAll = this.createSetOperator('except', true);\n\n\t/** @internal */\n\taddSetOperators(setOperators: CockroachSelectConfig['setOperators']): CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\tthis.config.setOperators.push(...setOperators);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#filtering}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be selected.\n\t *\n\t * ```ts\n\t * // Select all cars with green color\n\t * await db.select().from(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * await db.select().from(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Select all BMW cars with a green color\n\t * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Select all cars with the green or blue color\n\t * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(\n\t\twhere: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'where'> {\n\t\tif (typeof where === 'function') {\n\t\t\twhere = where(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `having` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @param having the `having` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all brands with more than one car\n\t * await db.select({\n\t * \tbrand: cars.brand,\n\t * \tcount: sql<number>`cast(count(${cars.id}) as int)`,\n\t * })\n\t * .from(cars)\n\t * .groupBy(cars.brand)\n\t * .having(({ count }) => gt(count, 1));\n\t * ```\n\t */\n\thaving(\n\t\thaving: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'having'> {\n\t\tif (typeof having === 'function') {\n\t\t\thaving = having(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.having = having;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `group by` clause to the query.\n\t *\n\t * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Group and count people by their last names\n\t * await db.select({\n\t * lastName: people.lastName,\n\t * count: sql<number>`cast(count(*) as int)`\n\t * })\n\t * .from(people)\n\t * .groupBy(people.lastName);\n\t * ```\n\t */\n\tgroupBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst groupBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t\tthis.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];\n\t\t} else {\n\t\t\tthis.config.groupBy = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `order by` clause to the query.\n\t *\n\t * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#order-by}\n\t *\n\t * @example\n\t *\n\t * ```\n\t * // Select cars ordered by year\n\t * await db.select().from(cars).orderBy(cars.year);\n\t * ```\n\t *\n\t * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.\n\t *\n\t * ```ts\n\t * // Select cars ordered by year in descending order\n\t * await db.select().from(cars).orderBy(desc(cars.year));\n\t *\n\t * // Select cars ordered by year and price\n\t * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));\n\t * ```\n\t */\n\torderBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst orderBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\n\t\t\tconst orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t} else {\n\t\t\tconst orderByArray = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `limit` clause to the query.\n\t *\n\t * Calling this method will set the maximum number of rows that will be returned by this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param limit the `limit` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the first 10 people from this query.\n\t * await db.select().from(people).limit(10);\n\t * ```\n\t */\n\tlimit(limit: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'limit'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.limit = limit;\n\t\t} else {\n\t\t\tthis.config.limit = limit;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `offset` clause to the query.\n\t *\n\t * Calling this method will skip a number of rows when returning results from this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param offset the `offset` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the 10th-20th people from this query.\n\t * await db.select().from(people).offset(10).limit(10);\n\t * ```\n\t */\n\toffset(offset: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'offset'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.offset = offset;\n\t\t} else {\n\t\t\tthis.config.offset = offset;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `for` clause to the query.\n\t *\n\t * Calling this method will specify a lock strength for this query that controls how strictly it acquires exclusive access to the rows being queried.\n\t *\n\t * See docs: {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE}\n\t *\n\t * @param strength the lock strength.\n\t * @param config the lock configuration.\n\t */\n\tfor(strength: LockStrength, config: LockConfig = {}): CockroachSelectWithout<this, TDynamic, 'for'> {\n\t\tthis.config.lockingClause = { strength, config };\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildSelectQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tas<TAlias extends string>(\n\t\talias: TAlias,\n\t): SubqueryWithSelection<this['_']['selectedFields'], TAlias> {\n\t\treturn new Proxy(\n\t\t\tnew Subquery(this.getSQL(), this.config.fields, alias),\n\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as SubqueryWithSelection<this['_']['selectedFields'], TAlias>;\n\t}\n\n\t/** @internal */\n\toverride getSelectedFields(): this['_']['selectedFields'] {\n\t\treturn new Proxy(\n\t\t\tthis.config.fields,\n\t\t\tnew SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as this['_']['selectedFields'];\n\t}\n\n\t/** @internal */\n\toverride withoutSelectionCastCodecs(): this {\n\t\treturn this;\n\t}\n\n\t$dynamic(): CockroachSelectDynamic<this> {\n\t\treturn this;\n\t}\n}\n\nexport interface CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends\n\tCockroachSelectQueryBuilderBase<\n\t\tCockroachSelectHKT,\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tQueryPromise<TResult>,\n\tSQLWrapper\n{}\n\nexport class CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends CockroachSelectQueryBuilderBase<\n\tCockroachSelectHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTNullabilityMap,\n\tTDynamic,\n\tTExcludedMethods,\n\tTResult,\n\tTSelectedFields\n> implements RunnableQuery<TResult, 'cockroach'>, SQLWrapper {\n\tstatic override readonly [entityKind]: string = 'CockroachSelect';\n\n\t/** @internal */\n\t_prepare(name?: string, generateName = false): CockroachSelectPrepare<this> {\n\t\tconst { session, config, dialect, joinsNotNullableMap } = this;\n\t\tif (!session) {\n\t\t\tthrow new Error('Cannot execute a query on a query builder. Please use a database instance instead.');\n\t\t}\n\t\treturn tracer.startActiveSpan('drizzle.prepareQuery', () => {\n\t\t\tconst fieldsList = orderSelectedFields<CockroachColumn>(config.fields);\n\t\t\tconst query = dialect.sqlToQuery(this.getSQL());\n\t\t\tconst preparedQuery = session.prepareQuery<\n\t\t\t\tPreparedQueryConfig & { execute: TResult }\n\t\t\t>(\n\t\t\t\tquery,\n\t\t\t\tfieldsList,\n\t\t\t\tname ?? (generateName ? preparedStatementName(query.sql, query.params) : name),\n\t\t\t);\n\t\t\tpreparedQuery.joinsNotNullableMap = joinsNotNullableMap;\n\n\t\t\treturn preparedQuery;\n\t\t});\n\t}\n\n\t/**\n\t * Create a prepared statement for this query. This allows\n\t * the database to remember this query for the given session\n\t * and call it by name, rather than specifying the full query.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-prepare.html | Postgres prepare documentation}\n\t */\n\tprepare(name?: string): CockroachSelectPrepare<this> {\n\t\treturn this._prepare(name, true);\n\t}\n\n\texecute: ReturnType<this['prepare']>['execute'] = (placeholderValues) => {\n\t\treturn tracer.startActiveSpan('drizzle.operation', () => {\n\t\t\treturn this._prepare().execute(placeholderValues);\n\t\t});\n\t};\n}\n\napplyMixins(CockroachSelectBase, [QueryPromise]);\n\nfunction createSetOperator(type: SetOperator, isAll: boolean): CockroachCreateSetOperatorFn {\n\treturn (leftSelect, rightSelect, ...restSelects) => {\n\t\tconst setOperators = [rightSelect, ...restSelects].map((select) => ({\n\t\t\ttype,\n\t\t\tisAll,\n\t\t\trightSelect: select as AnyCockroachSelect,\n\t\t}));\n\n\t\tfor (const setOperator of setOperators) {\n\t\t\tif (!haveSameKeys((leftSelect as any).getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn (leftSelect as AnyCockroachSelect).addSetOperators(setOperators) as any;\n\t};\n}\n\nconst getCockroachSetOperators = () => ({\n\tunion,\n\tunionAll,\n\tintersect,\n\tintersectAll,\n\texcept,\n\texceptAll,\n});\n\n/**\n * Adds `union` set operator to the query.\n *\n * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n *\n * @example\n *\n * ```ts\n * // Select all unique names from customers and users tables\n * import { union } from 'drizzle-orm/cockroach-core'\n *\n * await union(\n * db.select({ name: users.name }).from(users),\n * db.select({ name: customers.name }).from(customers)\n * );\n * // or\n * await db.select({ name: users.name })\n * .from(users)\n * .union(\n * db.select({ name: customers.name }).from(customers)\n * );\n * ```\n */\nexport const union = createSetOperator('union', false);\n\n/**\n * Adds `union all` set operator to the query.\n *\n * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n *\n * @example\n *\n * ```ts\n * // Select all transaction ids from both online and in-store sales\n * import { unionAll } from 'drizzle-orm/cockroach-core'\n *\n * await unionAll(\n * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * // or\n * await db.select({ transaction: onlineSales.transactionId })\n * .from(onlineSales)\n * .unionAll(\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * ```\n */\nexport const unionAll = createSetOperator('union', true);\n\n/**\n * Adds `intersect` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n *\n * @example\n *\n * ```ts\n * // Select course names that are offered in both departments A and B\n * import { intersect } from 'drizzle-orm/cockroach-core'\n *\n * await intersect(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .intersect(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const intersect = createSetOperator('intersect', false);\n\n/**\n * Adds `intersect all` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n *\n * @example\n *\n * ```ts\n * // Select all products and quantities that are ordered by both regular and VIP customers\n * import { intersectAll } from 'drizzle-orm/cockroach-core'\n *\n * await intersectAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders)\n * .intersectAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const intersectAll = createSetOperator('intersect', true);\n\n/**\n * Adds `except` set operator to the query.\n *\n * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n *\n * @example\n *\n * ```ts\n * // Select all courses offered in department A but not in department B\n * import { except } from 'drizzle-orm/cockroach-core'\n *\n * await except(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .except(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const except = createSetOperator('except', false);\n\n/**\n * Adds `except all` set operator to the query.\n *\n * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n *\n * @example\n *\n * ```ts\n * // Select all products that are ordered by regular customers but not by VIP customers\n * import { exceptAll } from 'drizzle-orm/cockroach-core'\n *\n * await exceptAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered,\n * })\n * .from(regularCustomerOrders)\n * .exceptAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered,\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const exceptAll = createSetOperator('except', true);\n"],"mappings":";;;;;;;;;;;;;;;;AA2DA,IAAa,yBAAb,MAGE;CACD,QAAiBA,0BAAsB;CAEvC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,WAAuB,E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;;;;;;;;;;;;;;;;;;;;;;;AA0C9D,MAAa,eAAe,kBAAkB,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BhE,MAAa,SAAS,kBAAkB,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CxD,MAAa,YAAY,kBAAkB,UAAU,KAAK"}
@@ -5,10 +5,10 @@ import { ViewBaseConfig } from "../../view-common.js";
5
5
  import { Table } from "../../table.js";
6
6
  import { applyMixins, getTableColumns, getTableLikeName, haveSameKeys, orderSelectedFields } from "../../utils.js";
7
7
  import { SQL, View } from "../../sql/sql.js";
8
+ import { preparedStatementName } from "../../query-name-generator.js";
8
9
  import { SelectionProxyHandler } from "../../selection-proxy.js";
9
10
  import { QueryPromise } from "../../query-promise.js";
10
11
  import { TypedQueryBuilder } from "../../query-builders/query-builder.js";
11
- import { preparedStatementName } from "../../query-name-generator.js";
12
12
  import { CockroachViewBase } from "../view-base.js";
13
13
 
14
14
  //#region src/cockroach-core/query-builders/select.ts
@@ -676,6 +676,10 @@ var CockroachSelectQueryBuilderBase = class extends TypedQueryBuilder {
676
676
  sqlBehavior: "error"
677
677
  }));
678
678
  }
679
+ /** @internal */
680
+ withoutSelectionCastCodecs() {
681
+ return this;
682
+ }
679
683
  $dynamic() {
680
684
  return this;
681
685
  }
@@ -689,7 +693,7 @@ var CockroachSelectBase = class extends CockroachSelectQueryBuilderBase {
689
693
  return tracer.startActiveSpan("drizzle.prepareQuery", () => {
690
694
  const fieldsList = orderSelectedFields(config.fields);
691
695
  const query = dialect.sqlToQuery(this.getSQL());
692
- const preparedQuery = session.prepareQuery(query, fieldsList, name ?? (generateName ? preparedStatementName(query.sql, query.params) : name), true);
696
+ const preparedQuery = session.prepareQuery(query, fieldsList, name ?? (generateName ? preparedStatementName(query.sql, query.params) : name));
693
697
  preparedQuery.joinsNotNullableMap = joinsNotNullableMap;
694
698
  return preparedQuery;
695
699
  });
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../src/cockroach-core/query-builders/select.ts"],"sourcesContent":["import type { CockroachColumn } from '~/cockroach-core/columns/index.ts';\nimport type { CockroachDialect } from '~/cockroach-core/dialect.ts';\nimport type { CockroachSession, PreparedQueryConfig } from '~/cockroach-core/session.ts';\nimport type { SubqueryWithSelection } from '~/cockroach-core/subquery.ts';\nimport type { CockroachTable } from '~/cockroach-core/table.ts';\nimport { CockroachViewBase } from '~/cockroach-core/view-base.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tGetSelectTableSelection,\n\tJoinNullability,\n\tJoinType,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport { preparedStatementName } from '~/query-name-generator.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { SQL, View } from '~/sql/sql.ts';\nimport type { ColumnsSelection, Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport { Subquery } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport { tracer } from '~/tracing.ts';\nimport {\n\tapplyMixins,\n\ttype DrizzleTypeError,\n\tgetTableColumns,\n\tgetTableLikeName,\n\thaveSameKeys,\n\torderSelectedFields,\n\ttype ValueOrArray,\n} from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type {\n\tAnyCockroachSelect,\n\tCockroachCreateSetOperatorFn,\n\tCockroachSelectConfig,\n\tCockroachSelectCrossJoinFn,\n\tCockroachSelectDynamic,\n\tCockroachSelectHKT,\n\tCockroachSelectHKTBase,\n\tCockroachSelectJoinFn,\n\tCockroachSelectPrepare,\n\tCockroachSelectWithout,\n\tCockroachSetOperatorExcludedMethods,\n\tCockroachSetOperatorWithResult,\n\tCreateCockroachSelectFromBuilderMode,\n\tGetCockroachSetOperators,\n\tLockConfig,\n\tLockStrength,\n\tSelectedFields,\n\tSetOperatorRightSelect,\n\tTableLikeHasEmptySelection,\n} from './select.types.ts';\n\nexport class CockroachSelectBuilder<\n\tTSelection extends SelectedFields | undefined,\n\tTBuilderMode extends 'db' | 'qb' = 'db',\n> {\n\tstatic readonly [entityKind]: string = 'CockroachSelectBuilder';\n\n\tprivate fields: TSelection;\n\tprivate session: CockroachSession | undefined;\n\tprivate dialect: CockroachDialect;\n\tprivate withList: Subquery[] = [];\n\tprivate distinct: boolean | {\n\t\ton: (CockroachColumn | SQLWrapper)[];\n\t} | undefined;\n\n\tconstructor(\n\t\tconfig: {\n\t\t\tfields: TSelection;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList?: Subquery[];\n\t\t\tdistinct?: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t};\n\t\t},\n\t) {\n\t\tthis.fields = config.fields;\n\t\tthis.session = config.session;\n\t\tthis.dialect = config.dialect;\n\t\tif (config.withList) {\n\t\t\tthis.withList = config.withList;\n\t\t}\n\t\tthis.distinct = config.distinct;\n\t}\n\n\t/**\n\t * Specify the table, subquery, or other target that you're\n\t * building a select query against.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM | Postgres from documentation}\n\t */\n\tfrom<TFrom extends CockroachTable | Subquery | CockroachViewBase | SQL>(\n\t\tsource: TableLikeHasEmptySelection<TFrom> extends true ? DrizzleTypeError<\n\t\t\t\t\"Cannot reference a data-modifying statement subquery if it doesn't contain a `returning` clause\"\n\t\t\t>\n\t\t\t: TFrom,\n\t): CreateCockroachSelectFromBuilderMode<\n\t\tTBuilderMode,\n\t\tGetSelectTableName<TFrom>,\n\t\tTSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection,\n\t\tTSelection extends undefined ? 'single' : 'partial'\n\t> {\n\t\tconst isPartialSelect = !!this.fields;\n\t\tconst src = source as TFrom;\n\n\t\tlet fields: SelectedFields;\n\t\tif (this.fields) {\n\t\t\tfields = this.fields;\n\t\t} else if (is(src, Subquery)) {\n\t\t\t// This is required to use the proxy handler to get the correct field values from the subquery\n\t\t\tfields = Object.fromEntries(\n\t\t\t\tObject.keys(src._.selectedFields).map((\n\t\t\t\t\tkey,\n\t\t\t\t) => [key, src[key as unknown as keyof typeof src] as unknown as SelectedFields[string]]),\n\t\t\t);\n\t\t} else if (is(src, CockroachViewBase)) {\n\t\t\tfields = src[ViewBaseConfig].selectedFields as SelectedFields;\n\t\t} else if (is(src, SQL)) {\n\t\t\tfields = {};\n\t\t} else {\n\t\t\tfields = getTableColumns<CockroachTable>(src);\n\t\t}\n\n\t\treturn (new CockroachSelectBase({\n\t\t\ttable: src,\n\t\t\tfields,\n\t\t\tisPartialSelect,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\twithList: this.withList,\n\t\t\tdistinct: this.distinct,\n\t\t}));\n\t}\n}\n\nexport abstract class CockroachSelectQueryBuilderBase<\n\tTHKT extends CockroachSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends TypedQueryBuilder<TSelectedFields, TResult> {\n\tstatic override readonly [entityKind]: string = 'CockroachSelectQueryBuilder';\n\n\toverride readonly _: {\n\t\treadonly dialect: 'cockroach';\n\t\treadonly hkt: THKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n\n\tprotected config: CockroachSelectConfig;\n\tprotected joinsNotNullableMap: Record<string, boolean>;\n\tprivate tableName: string | undefined;\n\tprivate isPartialSelect: boolean;\n\tprotected session: CockroachSession | undefined;\n\tprotected dialect: CockroachDialect;\n\n\tconstructor(\n\t\t{ table, fields, isPartialSelect, session, dialect, withList, distinct }: {\n\t\t\ttable: CockroachSelectConfig['table'];\n\t\t\tfields: CockroachSelectConfig['fields'];\n\t\t\tisPartialSelect: boolean;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList: Subquery[];\n\t\t\tdistinct: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t} | undefined;\n\t\t},\n\t) {\n\t\tsuper();\n\t\tthis.config = {\n\t\t\twithList,\n\t\t\ttable,\n\t\t\tfields: { ...fields },\n\t\t\tdistinct,\n\t\t\tsetOperators: [],\n\t\t};\n\t\tthis.isPartialSelect = isPartialSelect;\n\t\tthis.session = session;\n\t\tthis.dialect = dialect;\n\t\tthis._ = {\n\t\t\tselectedFields: fields as TSelectedFields,\n\t\t} as this['_'];\n\t\tthis.tableName = getTableLikeName(table);\n\t\tthis.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};\n\t}\n\n\tprivate createJoin<\n\t\tTJoinType extends JoinType,\n\t\tTIsLateral extends (TJoinType extends 'full' | 'right' ? false : boolean),\n\t>(\n\t\tjoinType: TJoinType,\n\t\tlateral: TIsLateral,\n\t): 'cross' extends TJoinType ? CockroachSelectCrossJoinFn<this, TDynamic, TIsLateral>\n\t\t: CockroachSelectJoinFn<this, TDynamic, TJoinType, TIsLateral>\n\t{\n\t\treturn ((\n\t\t\ttable: TIsLateral extends true ? Subquery | SQL : CockroachTable | Subquery | CockroachViewBase | SQL,\n\t\t\ton?: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t\t) => {\n\t\t\tconst baseTableName = this.tableName;\n\t\t\tconst tableName = getTableLikeName(table);\n\n\t\t\tif (typeof tableName === 'string' && this.config.joins?.some((join) => join.alias === tableName)) {\n\t\t\t\tthrow new Error(`Alias \"${tableName}\" is already used in this query`);\n\t\t\t}\n\n\t\t\tif (!this.isPartialSelect) {\n\t\t\t\t// If this is the first join and this is not a partial select and we're not selecting from raw SQL, \"move\" the fields from the main table to the nested object\n\t\t\t\tif (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === 'string') {\n\t\t\t\t\tthis.config.fields = {\n\t\t\t\t\t\t[baseTableName]: this.config.fields,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (typeof tableName === 'string' && !is(table, SQL)) {\n\t\t\t\t\tconst selection = is(table, Subquery)\n\t\t\t\t\t\t? table._.selectedFields\n\t\t\t\t\t\t: is(table, View)\n\t\t\t\t\t\t? table[ViewBaseConfig].selectedFields\n\t\t\t\t\t\t: table[Table.Symbol.Columns];\n\t\t\t\t\tthis.config.fields[tableName] = selection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof on === 'function') {\n\t\t\t\ton = on(\n\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\tthis.config.fields,\n\t\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t\t) as TSelection,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!this.config.joins) {\n\t\t\t\tthis.config.joins = [];\n\t\t\t}\n\n\t\t\tthis.config.joins.push({ on, table, joinType, alias: tableName, lateral });\n\n\t\t\tif (typeof tableName === 'string') {\n\t\t\t\tswitch (joinType) {\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'right': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'cross':\n\t\t\t\t\tcase 'inner': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'full': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this as any;\n\t\t}) as any;\n\t}\n\n\t/**\n\t * Executes a `left join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tleftJoin = this.createJoin('left', false);\n\n\t/**\n\t * Executes a `left join lateral` operation by adding subquery to the current query.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tleftJoinLateral = this.createJoin('left', true);\n\n\t/**\n\t * Executes a `right join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\trightJoin = this.createJoin('right', false);\n\n\t/**\n\t * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tinnerJoin = this.createJoin('inner', false);\n\n\t/**\n\t * Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tinnerJoinLateral = this.createJoin('inner', true);\n\n\t/**\n\t * Executes a `full join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tfullJoin = this.createJoin('full', false);\n\n\t/**\n\t * Executes a `cross join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}\n\t *\n\t * @param table the table to join.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users, each user with every pet\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .crossJoin(pets)\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .crossJoin(pets)\n\t * ```\n\t */\n\tcrossJoin = this.createJoin('cross', false);\n\n\t/**\n\t * Executes a `cross join lateral` operation by combining rows from two queries into a new table.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}\n\t *\n\t * @param table the query to join.\n\t */\n\tcrossJoinLateral = this.createJoin('cross', true);\n\n\tprivate createSetOperator(\n\t\ttype: SetOperator,\n\t\tisAll: boolean,\n\t): <TValue extends CockroachSetOperatorWithResult<TResult>>(\n\t\trightSelection:\n\t\t\t| ((setOperators: GetCockroachSetOperators) => SetOperatorRightSelect<TValue, TResult>)\n\t\t\t| SetOperatorRightSelect<TValue, TResult>,\n\t) => CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\treturn (rightSelection) => {\n\t\t\tconst rightSelect = (typeof rightSelection === 'function'\n\t\t\t\t? rightSelection(getCockroachSetOperators())\n\t\t\t\t: rightSelection) as TypedQueryBuilder<\n\t\t\t\t\tany,\n\t\t\t\t\tTResult\n\t\t\t\t>;\n\n\t\t\tif (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.config.setOperators.push({ type, isAll, rightSelect });\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Adds `union` set operator to the query.\n\t *\n\t * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique names from customers and users tables\n\t * await db.select({ name: users.name })\n\t * .from(users)\n\t * .union(\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * // or\n\t * import { union } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await union(\n\t * db.select({ name: users.name }).from(users),\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * ```\n\t */\n\tunion = this.createSetOperator('union', false);\n\n\t/**\n\t * Adds `union all` set operator to the query.\n\t *\n\t * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all transaction ids from both online and in-store sales\n\t * await db.select({ transaction: onlineSales.transactionId })\n\t * .from(onlineSales)\n\t * .unionAll(\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * // or\n\t * import { unionAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await unionAll(\n\t * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * ```\n\t */\n\tunionAll = this.createSetOperator('union', true);\n\n\t/**\n\t * Adds `intersect` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select course names that are offered in both departments A and B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .intersect(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { intersect } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersect(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\tintersect = this.createSetOperator('intersect', false);\n\n\t/**\n\t * Adds `intersect all` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products and quantities that are ordered by both regular and VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .intersectAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { intersectAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersectAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\tintersectAll = this.createSetOperator('intersect', true);\n\n\t/**\n\t * Adds `except` set operator to the query.\n\t *\n\t * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all courses offered in department A but not in department B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .except(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { except } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await except(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\texcept = this.createSetOperator('except', false);\n\n\t/**\n\t * Adds `except all` set operator to the query.\n\t *\n\t * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products that are ordered by regular customers but not by VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .exceptAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { exceptAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await exceptAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\texceptAll = this.createSetOperator('except', true);\n\n\t/** @internal */\n\taddSetOperators(setOperators: CockroachSelectConfig['setOperators']): CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\tthis.config.setOperators.push(...setOperators);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#filtering}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be selected.\n\t *\n\t * ```ts\n\t * // Select all cars with green color\n\t * await db.select().from(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * await db.select().from(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Select all BMW cars with a green color\n\t * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Select all cars with the green or blue color\n\t * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(\n\t\twhere: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'where'> {\n\t\tif (typeof where === 'function') {\n\t\t\twhere = where(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `having` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @param having the `having` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all brands with more than one car\n\t * await db.select({\n\t * \tbrand: cars.brand,\n\t * \tcount: sql<number>`cast(count(${cars.id}) as int)`,\n\t * })\n\t * .from(cars)\n\t * .groupBy(cars.brand)\n\t * .having(({ count }) => gt(count, 1));\n\t * ```\n\t */\n\thaving(\n\t\thaving: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'having'> {\n\t\tif (typeof having === 'function') {\n\t\t\thaving = having(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.having = having;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `group by` clause to the query.\n\t *\n\t * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Group and count people by their last names\n\t * await db.select({\n\t * lastName: people.lastName,\n\t * count: sql<number>`cast(count(*) as int)`\n\t * })\n\t * .from(people)\n\t * .groupBy(people.lastName);\n\t * ```\n\t */\n\tgroupBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst groupBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t\tthis.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];\n\t\t} else {\n\t\t\tthis.config.groupBy = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `order by` clause to the query.\n\t *\n\t * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#order-by}\n\t *\n\t * @example\n\t *\n\t * ```\n\t * // Select cars ordered by year\n\t * await db.select().from(cars).orderBy(cars.year);\n\t * ```\n\t *\n\t * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.\n\t *\n\t * ```ts\n\t * // Select cars ordered by year in descending order\n\t * await db.select().from(cars).orderBy(desc(cars.year));\n\t *\n\t * // Select cars ordered by year and price\n\t * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));\n\t * ```\n\t */\n\torderBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst orderBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\n\t\t\tconst orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t} else {\n\t\t\tconst orderByArray = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `limit` clause to the query.\n\t *\n\t * Calling this method will set the maximum number of rows that will be returned by this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param limit the `limit` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the first 10 people from this query.\n\t * await db.select().from(people).limit(10);\n\t * ```\n\t */\n\tlimit(limit: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'limit'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.limit = limit;\n\t\t} else {\n\t\t\tthis.config.limit = limit;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `offset` clause to the query.\n\t *\n\t * Calling this method will skip a number of rows when returning results from this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param offset the `offset` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the 10th-20th people from this query.\n\t * await db.select().from(people).offset(10).limit(10);\n\t * ```\n\t */\n\toffset(offset: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'offset'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.offset = offset;\n\t\t} else {\n\t\t\tthis.config.offset = offset;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `for` clause to the query.\n\t *\n\t * Calling this method will specify a lock strength for this query that controls how strictly it acquires exclusive access to the rows being queried.\n\t *\n\t * See docs: {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE}\n\t *\n\t * @param strength the lock strength.\n\t * @param config the lock configuration.\n\t */\n\tfor(strength: LockStrength, config: LockConfig = {}): CockroachSelectWithout<this, TDynamic, 'for'> {\n\t\tthis.config.lockingClause = { strength, config };\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildSelectQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tas<TAlias extends string>(\n\t\talias: TAlias,\n\t): SubqueryWithSelection<this['_']['selectedFields'], TAlias> {\n\t\treturn new Proxy(\n\t\t\tnew Subquery(this.getSQL(), this.config.fields, alias),\n\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as SubqueryWithSelection<this['_']['selectedFields'], TAlias>;\n\t}\n\n\t/** @internal */\n\toverride getSelectedFields(): this['_']['selectedFields'] {\n\t\treturn new Proxy(\n\t\t\tthis.config.fields,\n\t\t\tnew SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as this['_']['selectedFields'];\n\t}\n\n\t$dynamic(): CockroachSelectDynamic<this> {\n\t\treturn this;\n\t}\n}\n\nexport interface CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends\n\tCockroachSelectQueryBuilderBase<\n\t\tCockroachSelectHKT,\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tQueryPromise<TResult>,\n\tSQLWrapper\n{}\n\nexport class CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends CockroachSelectQueryBuilderBase<\n\tCockroachSelectHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTNullabilityMap,\n\tTDynamic,\n\tTExcludedMethods,\n\tTResult,\n\tTSelectedFields\n> implements RunnableQuery<TResult, 'cockroach'>, SQLWrapper {\n\tstatic override readonly [entityKind]: string = 'CockroachSelect';\n\n\t/** @internal */\n\t_prepare(name?: string, generateName = false): CockroachSelectPrepare<this> {\n\t\tconst { session, config, dialect, joinsNotNullableMap } = this;\n\t\tif (!session) {\n\t\t\tthrow new Error('Cannot execute a query on a query builder. Please use a database instance instead.');\n\t\t}\n\t\treturn tracer.startActiveSpan('drizzle.prepareQuery', () => {\n\t\t\tconst fieldsList = orderSelectedFields<CockroachColumn>(config.fields);\n\t\t\tconst query = dialect.sqlToQuery(this.getSQL());\n\t\t\tconst preparedQuery = session.prepareQuery<\n\t\t\t\tPreparedQueryConfig & { execute: TResult }\n\t\t\t>(\n\t\t\t\tquery,\n\t\t\t\tfieldsList,\n\t\t\t\tname ?? (generateName ? preparedStatementName(query.sql, query.params) : name),\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\tpreparedQuery.joinsNotNullableMap = joinsNotNullableMap;\n\n\t\t\treturn preparedQuery;\n\t\t});\n\t}\n\n\t/**\n\t * Create a prepared statement for this query. This allows\n\t * the database to remember this query for the given session\n\t * and call it by name, rather than specifying the full query.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-prepare.html | Postgres prepare documentation}\n\t */\n\tprepare(name?: string): CockroachSelectPrepare<this> {\n\t\treturn this._prepare(name, true);\n\t}\n\n\texecute: ReturnType<this['prepare']>['execute'] = (placeholderValues) => {\n\t\treturn tracer.startActiveSpan('drizzle.operation', () => {\n\t\t\treturn this._prepare().execute(placeholderValues);\n\t\t});\n\t};\n}\n\napplyMixins(CockroachSelectBase, [QueryPromise]);\n\nfunction createSetOperator(type: SetOperator, isAll: boolean): CockroachCreateSetOperatorFn {\n\treturn (leftSelect, rightSelect, ...restSelects) => {\n\t\tconst setOperators = [rightSelect, ...restSelects].map((select) => ({\n\t\t\ttype,\n\t\t\tisAll,\n\t\t\trightSelect: select as AnyCockroachSelect,\n\t\t}));\n\n\t\tfor (const setOperator of setOperators) {\n\t\t\tif (!haveSameKeys((leftSelect as any).getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn (leftSelect as AnyCockroachSelect).addSetOperators(setOperators) as any;\n\t};\n}\n\nconst getCockroachSetOperators = () => ({\n\tunion,\n\tunionAll,\n\tintersect,\n\tintersectAll,\n\texcept,\n\texceptAll,\n});\n\n/**\n * Adds `union` set operator to the query.\n *\n * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n *\n * @example\n *\n * ```ts\n * // Select all unique names from customers and users tables\n * import { union } from 'drizzle-orm/cockroach-core'\n *\n * await union(\n * db.select({ name: users.name }).from(users),\n * db.select({ name: customers.name }).from(customers)\n * );\n * // or\n * await db.select({ name: users.name })\n * .from(users)\n * .union(\n * db.select({ name: customers.name }).from(customers)\n * );\n * ```\n */\nexport const union = createSetOperator('union', false);\n\n/**\n * Adds `union all` set operator to the query.\n *\n * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n *\n * @example\n *\n * ```ts\n * // Select all transaction ids from both online and in-store sales\n * import { unionAll } from 'drizzle-orm/cockroach-core'\n *\n * await unionAll(\n * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * // or\n * await db.select({ transaction: onlineSales.transactionId })\n * .from(onlineSales)\n * .unionAll(\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * ```\n */\nexport const unionAll = createSetOperator('union', true);\n\n/**\n * Adds `intersect` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n *\n * @example\n *\n * ```ts\n * // Select course names that are offered in both departments A and B\n * import { intersect } from 'drizzle-orm/cockroach-core'\n *\n * await intersect(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .intersect(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const intersect = createSetOperator('intersect', false);\n\n/**\n * Adds `intersect all` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n *\n * @example\n *\n * ```ts\n * // Select all products and quantities that are ordered by both regular and VIP customers\n * import { intersectAll } from 'drizzle-orm/cockroach-core'\n *\n * await intersectAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders)\n * .intersectAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const intersectAll = createSetOperator('intersect', true);\n\n/**\n * Adds `except` set operator to the query.\n *\n * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n *\n * @example\n *\n * ```ts\n * // Select all courses offered in department A but not in department B\n * import { except } from 'drizzle-orm/cockroach-core'\n *\n * await except(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .except(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const except = createSetOperator('except', false);\n\n/**\n * Adds `except all` set operator to the query.\n *\n * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n *\n * @example\n *\n * ```ts\n * // Select all products that are ordered by regular customers but not by VIP customers\n * import { exceptAll } from 'drizzle-orm/cockroach-core'\n *\n * await exceptAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered,\n * })\n * .from(regularCustomerOrders)\n * .exceptAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered,\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const exceptAll = createSetOperator('except', true);\n"],"mappings":";;;;;;;;;;;;;;AA2DA,IAAa,yBAAb,MAGE;CACD,QAAiB,cAAsB;CAEvC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,WAAuB,EAAE;CACjC,AAAQ;CAIR,YACC,QASC;AACD,OAAK,SAAS,OAAO;AACrB,OAAK,UAAU,OAAO;AACtB,OAAK,UAAU,OAAO;AACtB,MAAI,OA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AS,kBAAkB,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CxD,MAAa,YAAY,kBAAkB,UAAU,KAAK"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../src/cockroach-core/query-builders/select.ts"],"sourcesContent":["import type { CockroachColumn } from '~/cockroach-core/columns/index.ts';\nimport type { CockroachDialect } from '~/cockroach-core/dialect.ts';\nimport type { CockroachSession, PreparedQueryConfig } from '~/cockroach-core/session.ts';\nimport type { SubqueryWithSelection } from '~/cockroach-core/subquery.ts';\nimport type { CockroachTable } from '~/cockroach-core/table.ts';\nimport { CockroachViewBase } from '~/cockroach-core/view-base.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tGetSelectTableSelection,\n\tJoinNullability,\n\tJoinType,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport { preparedStatementName } from '~/query-name-generator.ts';\nimport { QueryPromise } from '~/query-promise.ts';\nimport type { RunnableQuery } from '~/runnable-query.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport { SQL, View } from '~/sql/sql.ts';\nimport type { ColumnsSelection, Placeholder, Query, SQLWrapper } from '~/sql/sql.ts';\nimport { Subquery } from '~/subquery.ts';\nimport { Table } from '~/table.ts';\nimport { tracer } from '~/tracing.ts';\nimport {\n\tapplyMixins,\n\ttype DrizzleTypeError,\n\tgetTableColumns,\n\tgetTableLikeName,\n\thaveSameKeys,\n\torderSelectedFields,\n\ttype ValueOrArray,\n} from '~/utils.ts';\nimport { ViewBaseConfig } from '~/view-common.ts';\nimport type {\n\tAnyCockroachSelect,\n\tCockroachCreateSetOperatorFn,\n\tCockroachSelectConfig,\n\tCockroachSelectCrossJoinFn,\n\tCockroachSelectDynamic,\n\tCockroachSelectHKT,\n\tCockroachSelectHKTBase,\n\tCockroachSelectJoinFn,\n\tCockroachSelectPrepare,\n\tCockroachSelectWithout,\n\tCockroachSetOperatorExcludedMethods,\n\tCockroachSetOperatorWithResult,\n\tCreateCockroachSelectFromBuilderMode,\n\tGetCockroachSetOperators,\n\tLockConfig,\n\tLockStrength,\n\tSelectedFields,\n\tSetOperatorRightSelect,\n\tTableLikeHasEmptySelection,\n} from './select.types.ts';\n\nexport class CockroachSelectBuilder<\n\tTSelection extends SelectedFields | undefined,\n\tTBuilderMode extends 'db' | 'qb' = 'db',\n> {\n\tstatic readonly [entityKind]: string = 'CockroachSelectBuilder';\n\n\tprivate fields: TSelection;\n\tprivate session: CockroachSession | undefined;\n\tprivate dialect: CockroachDialect;\n\tprivate withList: Subquery[] = [];\n\tprivate distinct: boolean | {\n\t\ton: (CockroachColumn | SQLWrapper)[];\n\t} | undefined;\n\n\tconstructor(\n\t\tconfig: {\n\t\t\tfields: TSelection;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList?: Subquery[];\n\t\t\tdistinct?: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t};\n\t\t},\n\t) {\n\t\tthis.fields = config.fields;\n\t\tthis.session = config.session;\n\t\tthis.dialect = config.dialect;\n\t\tif (config.withList) {\n\t\t\tthis.withList = config.withList;\n\t\t}\n\t\tthis.distinct = config.distinct;\n\t}\n\n\t/**\n\t * Specify the table, subquery, or other target that you're\n\t * building a select query against.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM | Postgres from documentation}\n\t */\n\tfrom<TFrom extends CockroachTable | Subquery | CockroachViewBase | SQL>(\n\t\tsource: TableLikeHasEmptySelection<TFrom> extends true ? DrizzleTypeError<\n\t\t\t\t\"Cannot reference a data-modifying statement subquery if it doesn't contain a `returning` clause\"\n\t\t\t>\n\t\t\t: TFrom,\n\t): CreateCockroachSelectFromBuilderMode<\n\t\tTBuilderMode,\n\t\tGetSelectTableName<TFrom>,\n\t\tTSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection,\n\t\tTSelection extends undefined ? 'single' : 'partial'\n\t> {\n\t\tconst isPartialSelect = !!this.fields;\n\t\tconst src = source as TFrom;\n\n\t\tlet fields: SelectedFields;\n\t\tif (this.fields) {\n\t\t\tfields = this.fields;\n\t\t} else if (is(src, Subquery)) {\n\t\t\t// This is required to use the proxy handler to get the correct field values from the subquery\n\t\t\tfields = Object.fromEntries(\n\t\t\t\tObject.keys(src._.selectedFields).map((\n\t\t\t\t\tkey,\n\t\t\t\t) => [key, src[key as unknown as keyof typeof src] as unknown as SelectedFields[string]]),\n\t\t\t);\n\t\t} else if (is(src, CockroachViewBase)) {\n\t\t\tfields = src[ViewBaseConfig].selectedFields as SelectedFields;\n\t\t} else if (is(src, SQL)) {\n\t\t\tfields = {};\n\t\t} else {\n\t\t\tfields = getTableColumns<CockroachTable>(src);\n\t\t}\n\n\t\treturn (new CockroachSelectBase({\n\t\t\ttable: src,\n\t\t\tfields,\n\t\t\tisPartialSelect,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\twithList: this.withList,\n\t\t\tdistinct: this.distinct,\n\t\t}));\n\t}\n}\n\nexport abstract class CockroachSelectQueryBuilderBase<\n\tTHKT extends CockroachSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends TypedQueryBuilder<TSelectedFields, TResult> {\n\tstatic override readonly [entityKind]: string = 'CockroachSelectQueryBuilder';\n\n\toverride readonly _: {\n\t\treadonly dialect: 'cockroach';\n\t\treadonly hkt: THKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n\n\tprotected config: CockroachSelectConfig;\n\tprotected joinsNotNullableMap: Record<string, boolean>;\n\tprivate tableName: string | undefined;\n\tprivate isPartialSelect: boolean;\n\tprotected session: CockroachSession | undefined;\n\tprotected dialect: CockroachDialect;\n\n\tconstructor(\n\t\t{ table, fields, isPartialSelect, session, dialect, withList, distinct }: {\n\t\t\ttable: CockroachSelectConfig['table'];\n\t\t\tfields: CockroachSelectConfig['fields'];\n\t\t\tisPartialSelect: boolean;\n\t\t\tsession: CockroachSession | undefined;\n\t\t\tdialect: CockroachDialect;\n\t\t\twithList: Subquery[];\n\t\t\tdistinct: boolean | {\n\t\t\t\ton: (CockroachColumn | SQLWrapper)[];\n\t\t\t} | undefined;\n\t\t},\n\t) {\n\t\tsuper();\n\t\tthis.config = {\n\t\t\twithList,\n\t\t\ttable,\n\t\t\tfields: { ...fields },\n\t\t\tdistinct,\n\t\t\tsetOperators: [],\n\t\t};\n\t\tthis.isPartialSelect = isPartialSelect;\n\t\tthis.session = session;\n\t\tthis.dialect = dialect;\n\t\tthis._ = {\n\t\t\tselectedFields: fields as TSelectedFields,\n\t\t} as this['_'];\n\t\tthis.tableName = getTableLikeName(table);\n\t\tthis.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};\n\t}\n\n\tprivate createJoin<\n\t\tTJoinType extends JoinType,\n\t\tTIsLateral extends (TJoinType extends 'full' | 'right' ? false : boolean),\n\t>(\n\t\tjoinType: TJoinType,\n\t\tlateral: TIsLateral,\n\t): 'cross' extends TJoinType ? CockroachSelectCrossJoinFn<this, TDynamic, TIsLateral>\n\t\t: CockroachSelectJoinFn<this, TDynamic, TJoinType, TIsLateral>\n\t{\n\t\treturn ((\n\t\t\ttable: TIsLateral extends true ? Subquery | SQL : CockroachTable | Subquery | CockroachViewBase | SQL,\n\t\t\ton?: ((aliases: TSelection) => SQL | undefined) | SQL | undefined,\n\t\t) => {\n\t\t\tconst baseTableName = this.tableName;\n\t\t\tconst tableName = getTableLikeName(table);\n\n\t\t\tif (typeof tableName === 'string' && this.config.joins?.some((join) => join.alias === tableName)) {\n\t\t\t\tthrow new Error(`Alias \"${tableName}\" is already used in this query`);\n\t\t\t}\n\n\t\t\tif (!this.isPartialSelect) {\n\t\t\t\t// If this is the first join and this is not a partial select and we're not selecting from raw SQL, \"move\" the fields from the main table to the nested object\n\t\t\t\tif (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === 'string') {\n\t\t\t\t\tthis.config.fields = {\n\t\t\t\t\t\t[baseTableName]: this.config.fields,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif (typeof tableName === 'string' && !is(table, SQL)) {\n\t\t\t\t\tconst selection = is(table, Subquery)\n\t\t\t\t\t\t? table._.selectedFields\n\t\t\t\t\t\t: is(table, View)\n\t\t\t\t\t\t? table[ViewBaseConfig].selectedFields\n\t\t\t\t\t\t: table[Table.Symbol.Columns];\n\t\t\t\t\tthis.config.fields[tableName] = selection;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof on === 'function') {\n\t\t\t\ton = on(\n\t\t\t\t\tnew Proxy(\n\t\t\t\t\t\tthis.config.fields,\n\t\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t\t) as TSelection,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!this.config.joins) {\n\t\t\t\tthis.config.joins = [];\n\t\t\t}\n\n\t\t\tthis.config.joins.push({ on, table, joinType, alias: tableName, lateral });\n\n\t\t\tif (typeof tableName === 'string') {\n\t\t\t\tswitch (joinType) {\n\t\t\t\t\tcase 'left': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'right': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'cross':\n\t\t\t\t\tcase 'inner': {\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'full': {\n\t\t\t\t\t\tthis.joinsNotNullableMap = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries(this.joinsNotNullableMap).map(([key]) => [key, false]),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.joinsNotNullableMap[tableName] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this as any;\n\t\t}) as any;\n\t}\n\n\t/**\n\t * Executes a `left join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .leftJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tleftJoin = this.createJoin('left', false);\n\n\t/**\n\t * Executes a `left join lateral` operation by adding subquery to the current query.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tleftJoinLateral = this.createJoin('left', true);\n\n\t/**\n\t * Executes a `right join` operation by adding another table to the current query.\n\t *\n\t * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .rightJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\trightJoin = this.createJoin('right', false);\n\n\t/**\n\t * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .innerJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tinnerJoin = this.createJoin('inner', false);\n\n\t/**\n\t * Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}\n\t *\n\t * @param table the subquery to join.\n\t * @param on the `on` clause.\n\t */\n\tinnerJoinLateral = this.createJoin('inner', true);\n\n\t/**\n\t * Executes a `full join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}\n\t *\n\t * @param table the table to join.\n\t * @param on the `on` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users and their pets\n\t * const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .fullJoin(pets, eq(users.id, pets.ownerId))\n\t * ```\n\t */\n\tfullJoin = this.createJoin('full', false);\n\n\t/**\n\t * Executes a `cross join` operation by combining rows from two tables into a new table.\n\t *\n\t * Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}\n\t *\n\t * @param table the table to join.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all users, each user with every pet\n\t * const usersWithPets: { user: User; pets: Pet; }[] = await db.select()\n\t * .from(users)\n\t * .crossJoin(pets)\n\t *\n\t * // Select userId and petId\n\t * const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({\n\t * userId: users.id,\n\t * petId: pets.id,\n\t * })\n\t * .from(users)\n\t * .crossJoin(pets)\n\t * ```\n\t */\n\tcrossJoin = this.createJoin('cross', false);\n\n\t/**\n\t * Executes a `cross join lateral` operation by combining rows from two queries into a new table.\n\t *\n\t * A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.\n\t *\n\t * Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}\n\t *\n\t * @param table the query to join.\n\t */\n\tcrossJoinLateral = this.createJoin('cross', true);\n\n\tprivate createSetOperator(\n\t\ttype: SetOperator,\n\t\tisAll: boolean,\n\t): <TValue extends CockroachSetOperatorWithResult<TResult>>(\n\t\trightSelection:\n\t\t\t| ((setOperators: GetCockroachSetOperators) => SetOperatorRightSelect<TValue, TResult>)\n\t\t\t| SetOperatorRightSelect<TValue, TResult>,\n\t) => CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\treturn (rightSelection) => {\n\t\t\tconst rightSelect = (typeof rightSelection === 'function'\n\t\t\t\t? rightSelection(getCockroachSetOperators())\n\t\t\t\t: rightSelection) as TypedQueryBuilder<\n\t\t\t\t\tany,\n\t\t\t\t\tTResult\n\t\t\t\t>;\n\n\t\t\tif (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthis.config.setOperators.push({ type, isAll, rightSelect });\n\t\t\treturn this as any;\n\t\t};\n\t}\n\n\t/**\n\t * Adds `union` set operator to the query.\n\t *\n\t * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all unique names from customers and users tables\n\t * await db.select({ name: users.name })\n\t * .from(users)\n\t * .union(\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * // or\n\t * import { union } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await union(\n\t * db.select({ name: users.name }).from(users),\n\t * db.select({ name: customers.name }).from(customers)\n\t * );\n\t * ```\n\t */\n\tunion = this.createSetOperator('union', false);\n\n\t/**\n\t * Adds `union all` set operator to the query.\n\t *\n\t * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all transaction ids from both online and in-store sales\n\t * await db.select({ transaction: onlineSales.transactionId })\n\t * .from(onlineSales)\n\t * .unionAll(\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * // or\n\t * import { unionAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await unionAll(\n\t * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n\t * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n\t * );\n\t * ```\n\t */\n\tunionAll = this.createSetOperator('union', true);\n\n\t/**\n\t * Adds `intersect` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select course names that are offered in both departments A and B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .intersect(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { intersect } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersect(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\tintersect = this.createSetOperator('intersect', false);\n\n\t/**\n\t * Adds `intersect all` set operator to the query.\n\t *\n\t * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products and quantities that are ordered by both regular and VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .intersectAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { intersectAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await intersectAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\tintersectAll = this.createSetOperator('intersect', true);\n\n\t/**\n\t * Adds `except` set operator to the query.\n\t *\n\t * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all courses offered in department A but not in department B\n\t * await db.select({ courseName: depA.courseName })\n\t * .from(depA)\n\t * .except(\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * // or\n\t * import { except } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await except(\n\t * db.select({ courseName: depA.courseName }).from(depA),\n\t * db.select({ courseName: depB.courseName }).from(depB)\n\t * );\n\t * ```\n\t */\n\texcept = this.createSetOperator('except', false);\n\n\t/**\n\t * Adds `except all` set operator to the query.\n\t *\n\t * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all products that are ordered by regular customers but not by VIP customers\n\t * await db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(regularCustomerOrders)\n\t * .exceptAll(\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered,\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * // or\n\t * import { exceptAll } from 'drizzle-orm/cockroach-core'\n\t *\n\t * await exceptAll(\n\t * db.select({\n\t * productId: regularCustomerOrders.productId,\n\t * quantityOrdered: regularCustomerOrders.quantityOrdered\n\t * })\n\t * .from(regularCustomerOrders),\n\t * db.select({\n\t * productId: vipCustomerOrders.productId,\n\t * quantityOrdered: vipCustomerOrders.quantityOrdered\n\t * })\n\t * .from(vipCustomerOrders)\n\t * );\n\t * ```\n\t */\n\texceptAll = this.createSetOperator('except', true);\n\n\t/** @internal */\n\taddSetOperators(setOperators: CockroachSelectConfig['setOperators']): CockroachSelectWithout<\n\t\tthis,\n\t\tTDynamic,\n\t\tCockroachSetOperatorExcludedMethods,\n\t\ttrue\n\t> {\n\t\tthis.config.setOperators.push(...setOperators);\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `where` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#filtering}\n\t *\n\t * @param where the `where` clause.\n\t *\n\t * @example\n\t * You can use conditional operators and `sql function` to filter the rows to be selected.\n\t *\n\t * ```ts\n\t * // Select all cars with green color\n\t * await db.select().from(cars).where(eq(cars.color, 'green'));\n\t * // or\n\t * await db.select().from(cars).where(sql`${cars.color} = 'green'`)\n\t * ```\n\t *\n\t * You can logically combine conditional operators with `and()` and `or()` operators:\n\t *\n\t * ```ts\n\t * // Select all BMW cars with a green color\n\t * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));\n\t *\n\t * // Select all cars with the green or blue color\n\t * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));\n\t * ```\n\t */\n\twhere(\n\t\twhere: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'where'> {\n\t\tif (typeof where === 'function') {\n\t\t\twhere = where(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.where = where;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `having` clause to the query.\n\t *\n\t * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @param having the `having` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all brands with more than one car\n\t * await db.select({\n\t * \tbrand: cars.brand,\n\t * \tcount: sql<number>`cast(count(${cars.id}) as int)`,\n\t * })\n\t * .from(cars)\n\t * .groupBy(cars.brand)\n\t * .having(({ count }) => gt(count, 1));\n\t * ```\n\t */\n\thaving(\n\t\thaving: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined,\n\t): CockroachSelectWithout<this, TDynamic, 'having'> {\n\t\tif (typeof having === 'function') {\n\t\t\thaving = having(\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t}\n\t\tthis.config.having = having;\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `group by` clause to the query.\n\t *\n\t * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Group and count people by their last names\n\t * await db.select({\n\t * lastName: people.lastName,\n\t * count: sql<number>`cast(count(*) as int)`\n\t * })\n\t * .from(people)\n\t * .groupBy(people.lastName);\n\t * ```\n\t */\n\tgroupBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'groupBy'>;\n\tgroupBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'groupBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst groupBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\t\t\tthis.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];\n\t\t} else {\n\t\t\tthis.config.groupBy = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `order by` clause to the query.\n\t *\n\t * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#order-by}\n\t *\n\t * @example\n\t *\n\t * ```\n\t * // Select cars ordered by year\n\t * await db.select().from(cars).orderBy(cars.year);\n\t * ```\n\t *\n\t * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.\n\t *\n\t * ```ts\n\t * // Select cars ordered by year in descending order\n\t * await db.select().from(cars).orderBy(desc(cars.year));\n\t *\n\t * // Select cars ordered by year and price\n\t * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));\n\t * ```\n\t */\n\torderBy(\n\t\tbuilder: (aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>,\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(...columns: (CockroachColumn | SQL | SQL.Aliased)[]): CockroachSelectWithout<this, TDynamic, 'orderBy'>;\n\torderBy(\n\t\t...columns:\n\t\t\t| [(aliases: this['_']['selection']) => ValueOrArray<CockroachColumn | SQL | SQL.Aliased>]\n\t\t\t| (CockroachColumn | SQL | SQL.Aliased)[]\n\t): CockroachSelectWithout<this, TDynamic, 'orderBy'> {\n\t\tif (typeof columns[0] === 'function') {\n\t\t\tconst orderBy = columns[0](\n\t\t\t\tnew Proxy(\n\t\t\t\t\tthis.config.fields,\n\t\t\t\t\tnew SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),\n\t\t\t\t) as TSelection,\n\t\t\t);\n\n\t\t\tconst orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t} else {\n\t\t\tconst orderByArray = columns as (CockroachColumn | SQL | SQL.Aliased)[];\n\n\t\t\tif (this.config.setOperators.length > 0) {\n\t\t\t\tthis.config.setOperators.at(-1)!.orderBy = orderByArray;\n\t\t\t} else {\n\t\t\t\tthis.config.orderBy = orderByArray;\n\t\t\t}\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `limit` clause to the query.\n\t *\n\t * Calling this method will set the maximum number of rows that will be returned by this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param limit the `limit` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the first 10 people from this query.\n\t * await db.select().from(people).limit(10);\n\t * ```\n\t */\n\tlimit(limit: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'limit'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.limit = limit;\n\t\t} else {\n\t\t\tthis.config.limit = limit;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds an `offset` clause to the query.\n\t *\n\t * Calling this method will skip a number of rows when returning results from this query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}\n\t *\n\t * @param offset the `offset` clause.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Get the 10th-20th people from this query.\n\t * await db.select().from(people).offset(10).limit(10);\n\t * ```\n\t */\n\toffset(offset: number | Placeholder): CockroachSelectWithout<this, TDynamic, 'offset'> {\n\t\tif (this.config.setOperators.length > 0) {\n\t\t\tthis.config.setOperators.at(-1)!.offset = offset;\n\t\t} else {\n\t\t\tthis.config.offset = offset;\n\t\t}\n\t\treturn this as any;\n\t}\n\n\t/**\n\t * Adds a `for` clause to the query.\n\t *\n\t * Calling this method will specify a lock strength for this query that controls how strictly it acquires exclusive access to the rows being queried.\n\t *\n\t * See docs: {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE}\n\t *\n\t * @param strength the lock strength.\n\t * @param config the lock configuration.\n\t */\n\tfor(strength: LockStrength, config: LockConfig = {}): CockroachSelectWithout<this, TDynamic, 'for'> {\n\t\tthis.config.lockingClause = { strength, config };\n\t\treturn this as any;\n\t}\n\n\t/** @internal */\n\tgetSQL(): SQL {\n\t\treturn this.dialect.buildSelectQuery(this.config);\n\t}\n\n\ttoSQL(): Query {\n\t\tconst { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());\n\t\treturn rest;\n\t}\n\n\tas<TAlias extends string>(\n\t\talias: TAlias,\n\t): SubqueryWithSelection<this['_']['selectedFields'], TAlias> {\n\t\treturn new Proxy(\n\t\t\tnew Subquery(this.getSQL(), this.config.fields, alias),\n\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as SubqueryWithSelection<this['_']['selectedFields'], TAlias>;\n\t}\n\n\t/** @internal */\n\toverride getSelectedFields(): this['_']['selectedFields'] {\n\t\treturn new Proxy(\n\t\t\tthis.config.fields,\n\t\t\tnew SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t) as this['_']['selectedFields'];\n\t}\n\n\t/** @internal */\n\toverride withoutSelectionCastCodecs(): this {\n\t\treturn this;\n\t}\n\n\t$dynamic(): CockroachSelectDynamic<this> {\n\t\treturn this;\n\t}\n}\n\nexport interface CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends\n\tCockroachSelectQueryBuilderBase<\n\t\tCockroachSelectHKT,\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tQueryPromise<TResult>,\n\tSQLWrapper\n{}\n\nexport class CockroachSelectBase<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> extends CockroachSelectQueryBuilderBase<\n\tCockroachSelectHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTNullabilityMap,\n\tTDynamic,\n\tTExcludedMethods,\n\tTResult,\n\tTSelectedFields\n> implements RunnableQuery<TResult, 'cockroach'>, SQLWrapper {\n\tstatic override readonly [entityKind]: string = 'CockroachSelect';\n\n\t/** @internal */\n\t_prepare(name?: string, generateName = false): CockroachSelectPrepare<this> {\n\t\tconst { session, config, dialect, joinsNotNullableMap } = this;\n\t\tif (!session) {\n\t\t\tthrow new Error('Cannot execute a query on a query builder. Please use a database instance instead.');\n\t\t}\n\t\treturn tracer.startActiveSpan('drizzle.prepareQuery', () => {\n\t\t\tconst fieldsList = orderSelectedFields<CockroachColumn>(config.fields);\n\t\t\tconst query = dialect.sqlToQuery(this.getSQL());\n\t\t\tconst preparedQuery = session.prepareQuery<\n\t\t\t\tPreparedQueryConfig & { execute: TResult }\n\t\t\t>(\n\t\t\t\tquery,\n\t\t\t\tfieldsList,\n\t\t\t\tname ?? (generateName ? preparedStatementName(query.sql, query.params) : name),\n\t\t\t);\n\t\t\tpreparedQuery.joinsNotNullableMap = joinsNotNullableMap;\n\n\t\t\treturn preparedQuery;\n\t\t});\n\t}\n\n\t/**\n\t * Create a prepared statement for this query. This allows\n\t * the database to remember this query for the given session\n\t * and call it by name, rather than specifying the full query.\n\t *\n\t * {@link https://www.postgresql.org/docs/current/sql-prepare.html | Postgres prepare documentation}\n\t */\n\tprepare(name?: string): CockroachSelectPrepare<this> {\n\t\treturn this._prepare(name, true);\n\t}\n\n\texecute: ReturnType<this['prepare']>['execute'] = (placeholderValues) => {\n\t\treturn tracer.startActiveSpan('drizzle.operation', () => {\n\t\t\treturn this._prepare().execute(placeholderValues);\n\t\t});\n\t};\n}\n\napplyMixins(CockroachSelectBase, [QueryPromise]);\n\nfunction createSetOperator(type: SetOperator, isAll: boolean): CockroachCreateSetOperatorFn {\n\treturn (leftSelect, rightSelect, ...restSelects) => {\n\t\tconst setOperators = [rightSelect, ...restSelects].map((select) => ({\n\t\t\ttype,\n\t\t\tisAll,\n\t\t\trightSelect: select as AnyCockroachSelect,\n\t\t}));\n\n\t\tfor (const setOperator of setOperators) {\n\t\t\tif (!haveSameKeys((leftSelect as any).getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Set operator error (union / intersect / except): selected fields are not the same or are in a different order',\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn (leftSelect as AnyCockroachSelect).addSetOperators(setOperators) as any;\n\t};\n}\n\nconst getCockroachSetOperators = () => ({\n\tunion,\n\tunionAll,\n\tintersect,\n\tintersectAll,\n\texcept,\n\texceptAll,\n});\n\n/**\n * Adds `union` set operator to the query.\n *\n * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}\n *\n * @example\n *\n * ```ts\n * // Select all unique names from customers and users tables\n * import { union } from 'drizzle-orm/cockroach-core'\n *\n * await union(\n * db.select({ name: users.name }).from(users),\n * db.select({ name: customers.name }).from(customers)\n * );\n * // or\n * await db.select({ name: users.name })\n * .from(users)\n * .union(\n * db.select({ name: customers.name }).from(customers)\n * );\n * ```\n */\nexport const union = createSetOperator('union', false);\n\n/**\n * Adds `union all` set operator to the query.\n *\n * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}\n *\n * @example\n *\n * ```ts\n * // Select all transaction ids from both online and in-store sales\n * import { unionAll } from 'drizzle-orm/cockroach-core'\n *\n * await unionAll(\n * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * // or\n * await db.select({ transaction: onlineSales.transactionId })\n * .from(onlineSales)\n * .unionAll(\n * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)\n * );\n * ```\n */\nexport const unionAll = createSetOperator('union', true);\n\n/**\n * Adds `intersect` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}\n *\n * @example\n *\n * ```ts\n * // Select course names that are offered in both departments A and B\n * import { intersect } from 'drizzle-orm/cockroach-core'\n *\n * await intersect(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .intersect(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const intersect = createSetOperator('intersect', false);\n\n/**\n * Adds `intersect all` set operator to the query.\n *\n * Calling this method will retain only the rows that are present in both result sets including all duplicates.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}\n *\n * @example\n *\n * ```ts\n * // Select all products and quantities that are ordered by both regular and VIP customers\n * import { intersectAll } from 'drizzle-orm/cockroach-core'\n *\n * await intersectAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders)\n * .intersectAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const intersectAll = createSetOperator('intersect', true);\n\n/**\n * Adds `except` set operator to the query.\n *\n * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}\n *\n * @example\n *\n * ```ts\n * // Select all courses offered in department A but not in department B\n * import { except } from 'drizzle-orm/cockroach-core'\n *\n * await except(\n * db.select({ courseName: depA.courseName }).from(depA),\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * // or\n * await db.select({ courseName: depA.courseName })\n * .from(depA)\n * .except(\n * db.select({ courseName: depB.courseName }).from(depB)\n * );\n * ```\n */\nexport const except = createSetOperator('except', false);\n\n/**\n * Adds `except all` set operator to the query.\n *\n * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.\n *\n * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}\n *\n * @example\n *\n * ```ts\n * // Select all products that are ordered by regular customers but not by VIP customers\n * import { exceptAll } from 'drizzle-orm/cockroach-core'\n *\n * await exceptAll(\n * db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered\n * })\n * .from(regularCustomerOrders),\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered\n * })\n * .from(vipCustomerOrders)\n * );\n * // or\n * await db.select({\n * productId: regularCustomerOrders.productId,\n * quantityOrdered: regularCustomerOrders.quantityOrdered,\n * })\n * .from(regularCustomerOrders)\n * .exceptAll(\n * db.select({\n * productId: vipCustomerOrders.productId,\n * quantityOrdered: vipCustomerOrders.quantityOrdered,\n * })\n * .from(vipCustomerOrders)\n * );\n * ```\n */\nexport const exceptAll = createSetOperator('except', true);\n"],"mappings":";;;;;;;;;;;;;;AA2DA,IAAa,yBAAb,MAGE;CACD,QAAiB,cAAsB;CAEvC,AAAQ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;;;;;;;;;;;;;;;;;AA2BxD,MAAa,YAAY,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0C9D,MAAa,eAAe,kBAAkB,aAAa,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BhE,MAAa,SAAS,kBAAkB,UAAU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CxD,MAAa,YAAY,kBAAkB,UAAU,KAAK"}
@@ -6,9 +6,9 @@ let __view_common_ts = require("../../view-common.cjs");
6
6
  let __table_ts = require("../../table.cjs");
7
7
  let __utils_ts = require("../../utils.cjs");
8
8
  let __sql_sql_ts = require("../../sql/sql.cjs");
9
+ let __query_name_generator_ts = require("../../query-name-generator.cjs");
9
10
  let __selection_proxy_ts = require("../../selection-proxy.cjs");
10
11
  let __query_promise_ts = require("../../query-promise.cjs");
11
- let __query_name_generator_ts = require("../../query-name-generator.cjs");
12
12
  let __cockroach_core_table_ts = require("../table.cjs");
13
13
 
14
14
  //#region src/cockroach-core/query-builders/update.ts
@@ -167,7 +167,7 @@ var CockroachUpdateBase = class extends __query_promise_ts.QueryPromise {
167
167
  /** @internal */
168
168
  _prepare(name, generateName = false) {
169
169
  const query = this.dialect.sqlToQuery(this.getSQL());
170
- const preparedQuery = this.session.prepareQuery(query, this.config.returning, name ?? (generateName ? (0, __query_name_generator_ts.preparedStatementName)(query.sql, query.params) : name), true);
170
+ const preparedQuery = this.session.prepareQuery(query, this.config.returning, name ?? (generateName ? (0, __query_name_generator_ts.preparedStatementName)(query.sql, query.params) : name));
171
171
  preparedQuery.joinsNotNullableMap = this.joinsNotNullableMap;
172
172
  return preparedQuery;
173
173
  }
@@ -185,6 +185,10 @@ var CockroachUpdateBase = class extends __query_promise_ts.QueryPromise {
185
185
  sqlBehavior: "error"
186
186
  })) : void 0;
187
187
  }
188
+ /** @internal */
189
+ withoutSelectionCastCodecs() {
190
+ return this;
191
+ }
188
192
  $dynamic() {
189
193
  return this;
190
194
  }