@intentius/chant-lexicon-sql 0.0.0-stage → 0.112.1

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 (936) hide show
  1. package/README.md +39 -2
  2. package/dist/clickhouse/apply/apply.d.ts +82 -0
  3. package/dist/clickhouse/apply/apply.d.ts.map +1 -0
  4. package/dist/clickhouse/apply/mutations.d.ts +46 -0
  5. package/dist/clickhouse/apply/mutations.d.ts.map +1 -0
  6. package/dist/clickhouse/apply/statements.d.ts +99 -0
  7. package/dist/clickhouse/apply/statements.d.ts.map +1 -0
  8. package/dist/clickhouse/catalog-types.d.ts +76 -0
  9. package/dist/clickhouse/catalog-types.d.ts.map +1 -0
  10. package/dist/clickhouse/container.d.ts +63 -0
  11. package/dist/clickhouse/container.d.ts.map +1 -0
  12. package/dist/clickhouse/engine-syntax.d.ts +43 -0
  13. package/dist/clickhouse/engine-syntax.d.ts.map +1 -0
  14. package/dist/clickhouse/entities.d.ts +183 -0
  15. package/dist/clickhouse/entities.d.ts.map +1 -0
  16. package/dist/clickhouse/http.d.ts +40 -0
  17. package/dist/clickhouse/http.d.ts.map +1 -0
  18. package/dist/clickhouse/import/generator.d.ts +16 -0
  19. package/dist/clickhouse/import/generator.d.ts.map +1 -0
  20. package/dist/clickhouse/import/ir.d.ts +52 -0
  21. package/dist/clickhouse/import/ir.d.ts.map +1 -0
  22. package/dist/clickhouse/import/live-export.d.ts +28 -0
  23. package/dist/clickhouse/import/live-export.d.ts.map +1 -0
  24. package/dist/clickhouse/import/parser.d.ts +10 -0
  25. package/dist/clickhouse/import/parser.d.ts.map +1 -0
  26. package/dist/clickhouse/live/bind.d.ts +56 -0
  27. package/dist/clickhouse/live/bind.d.ts.map +1 -0
  28. package/dist/clickhouse/live/catalog.d.ts +39 -0
  29. package/dist/clickhouse/live/catalog.d.ts.map +1 -0
  30. package/dist/clickhouse/live/describe-resources.d.ts +34 -0
  31. package/dist/clickhouse/live/describe-resources.d.ts.map +1 -0
  32. package/dist/clickhouse/overlays/codecs.d.ts +28 -0
  33. package/dist/clickhouse/overlays/codecs.d.ts.map +1 -0
  34. package/dist/clickhouse/overlays/engines.d.ts +20 -0
  35. package/dist/clickhouse/overlays/engines.d.ts.map +1 -0
  36. package/dist/clickhouse/overlays/kinds.d.ts +38 -0
  37. package/dist/clickhouse/overlays/kinds.d.ts.map +1 -0
  38. package/dist/clickhouse/overlays/projections.d.ts +27 -0
  39. package/dist/clickhouse/overlays/projections.d.ts.map +1 -0
  40. package/dist/clickhouse/overlays/skip-indexes.d.ts +10 -0
  41. package/dist/clickhouse/overlays/skip-indexes.d.ts.map +1 -0
  42. package/dist/clickhouse/overlays/ttl.d.ts +35 -0
  43. package/dist/clickhouse/overlays/ttl.d.ts.map +1 -0
  44. package/dist/clickhouse/overlays/types.d.ts +21 -0
  45. package/dist/clickhouse/overlays/types.d.ts.map +1 -0
  46. package/dist/clickhouse/ownership.d.ts +71 -0
  47. package/dist/clickhouse/ownership.d.ts.map +1 -0
  48. package/dist/clickhouse/parser.d.ts +130 -0
  49. package/dist/clickhouse/parser.d.ts.map +1 -0
  50. package/dist/clickhouse/plan/commands.d.ts +26 -0
  51. package/dist/clickhouse/plan/commands.d.ts.map +1 -0
  52. package/dist/clickhouse/plan/deep.d.ts +32 -0
  53. package/dist/clickhouse/plan/deep.d.ts.map +1 -0
  54. package/dist/clickhouse/plan/diff.d.ts +37 -0
  55. package/dist/clickhouse/plan/diff.d.ts.map +1 -0
  56. package/dist/clickhouse/plan/disruption.d.ts +17 -0
  57. package/dist/clickhouse/plan/disruption.d.ts.map +1 -0
  58. package/dist/clickhouse/plan/normalize.d.ts +97 -0
  59. package/dist/clickhouse/plan/normalize.d.ts.map +1 -0
  60. package/dist/clickhouse/plan/rebuild-handoff.d.ts +38 -0
  61. package/dist/clickhouse/plan/rebuild-handoff.d.ts.map +1 -0
  62. package/dist/clickhouse/plan/report.d.ts +6 -0
  63. package/dist/clickhouse/plan/report.d.ts.map +1 -0
  64. package/dist/clickhouse/plan/rules.d.ts +60 -0
  65. package/dist/clickhouse/plan/rules.d.ts.map +1 -0
  66. package/dist/clickhouse/plan/schema.d.ts +23 -0
  67. package/dist/clickhouse/plan/schema.d.ts.map +1 -0
  68. package/dist/clickhouse/plan/server-format.d.ts +12 -0
  69. package/dist/clickhouse/plan/server-format.d.ts.map +1 -0
  70. package/dist/clickhouse/rebuild/backfill.d.ts +70 -0
  71. package/dist/clickhouse/rebuild/backfill.d.ts.map +1 -0
  72. package/dist/clickhouse/rebuild/observe.d.ts +157 -0
  73. package/dist/clickhouse/rebuild/observe.d.ts.map +1 -0
  74. package/dist/clickhouse/rebuild/op.d.ts +108 -0
  75. package/dist/clickhouse/rebuild/op.d.ts.map +1 -0
  76. package/dist/clickhouse/rebuild/partitions.d.ts +24 -0
  77. package/dist/clickhouse/rebuild/partitions.d.ts.map +1 -0
  78. package/dist/clickhouse/rebuild/receipts.d.ts +76 -0
  79. package/dist/clickhouse/rebuild/receipts.d.ts.map +1 -0
  80. package/dist/clickhouse/rebuild/replicas.d.ts +78 -0
  81. package/dist/clickhouse/rebuild/replicas.d.ts.map +1 -0
  82. package/dist/clickhouse/rebuild/steps.d.ts +151 -0
  83. package/dist/clickhouse/rebuild/steps.d.ts.map +1 -0
  84. package/dist/clickhouse/rebuild/verify.d.ts +51 -0
  85. package/dist/clickhouse/rebuild/verify.d.ts.map +1 -0
  86. package/dist/clickhouse/testing/fake-server.d.ts +27 -0
  87. package/dist/clickhouse/testing/fake-server.d.ts.map +1 -0
  88. package/dist/clickhouse/testing/roundtrip-schema.d.ts +3 -0
  89. package/dist/clickhouse/testing/roundtrip-schema.d.ts.map +1 -0
  90. package/dist/clickhouse/testing/writable-server.d.ts +35 -0
  91. package/dist/clickhouse/testing/writable-server.d.ts.map +1 -0
  92. package/dist/clickhouse/tokens.d.ts +15 -0
  93. package/dist/clickhouse/tokens.d.ts.map +1 -0
  94. package/dist/clickhouse.d.ts +24 -0
  95. package/dist/clickhouse.d.ts.map +1 -0
  96. package/dist/codegen/classifier-page.d.ts +6 -0
  97. package/dist/codegen/classifier-page.d.ts.map +1 -0
  98. package/dist/codegen/clickhouse-module.d.ts +23 -0
  99. package/dist/codegen/clickhouse-module.d.ts.map +1 -0
  100. package/dist/codegen/docs-cli.d.ts +3 -0
  101. package/dist/codegen/docs-cli.d.ts.map +1 -0
  102. package/dist/codegen/docs.d.ts +8 -0
  103. package/dist/codegen/docs.d.ts.map +1 -0
  104. package/dist/codegen/generate-cli.d.ts +3 -0
  105. package/dist/codegen/generate-cli.d.ts.map +1 -0
  106. package/dist/codegen/generate.d.ts +40 -0
  107. package/dist/codegen/generate.d.ts.map +1 -0
  108. package/dist/codegen/package.d.ts +7 -0
  109. package/dist/codegen/package.d.ts.map +1 -0
  110. package/dist/codegen/postgres-classifier-page.d.ts +7 -0
  111. package/dist/codegen/postgres-classifier-page.d.ts.map +1 -0
  112. package/dist/codegen/postgres-module.d.ts +30 -0
  113. package/dist/codegen/postgres-module.d.ts.map +1 -0
  114. package/dist/codegen/registry.d.ts +12 -0
  115. package/dist/codegen/registry.d.ts.map +1 -0
  116. package/dist/composites/audit-log-table.d.ts +31 -0
  117. package/dist/composites/audit-log-table.d.ts.map +1 -0
  118. package/dist/composites/catalog.d.ts +3 -0
  119. package/dist/composites/catalog.d.ts.map +1 -0
  120. package/dist/composites/cdc-mirror.d.ts +32 -0
  121. package/dist/composites/cdc-mirror.d.ts.map +1 -0
  122. package/dist/composites/clickhouse.d.ts +7 -0
  123. package/dist/composites/clickhouse.d.ts.map +1 -0
  124. package/dist/composites/events-table.d.ts +32 -0
  125. package/dist/composites/events-table.d.ts.map +1 -0
  126. package/dist/composites/index.d.ts +9 -0
  127. package/dist/composites/index.d.ts.map +1 -0
  128. package/dist/composites/join-table.d.ts +41 -0
  129. package/dist/composites/join-table.d.ts.map +1 -0
  130. package/dist/composites/postgres.d.ts +7 -0
  131. package/dist/composites/postgres.d.ts.map +1 -0
  132. package/dist/composites/refreshed-view.d.ts +32 -0
  133. package/dist/composites/refreshed-view.d.ts.map +1 -0
  134. package/dist/composites/replacing-table.d.ts +34 -0
  135. package/dist/composites/replacing-table.d.ts.map +1 -0
  136. package/dist/composites/rollup-view.d.ts +39 -0
  137. package/dist/composites/rollup-view.d.ts.map +1 -0
  138. package/dist/composites/sharded-table.d.ts +35 -0
  139. package/dist/composites/sharded-table.d.ts.map +1 -0
  140. package/dist/composites/soft-delete-table.d.ts +40 -0
  141. package/dist/composites/soft-delete-table.d.ts.map +1 -0
  142. package/dist/composites/tenant-table.d.ts +34 -0
  143. package/dist/composites/tenant-table.d.ts.map +1 -0
  144. package/dist/config.d.ts +213 -0
  145. package/dist/config.d.ts.map +1 -0
  146. package/dist/core/apply.d.ts +89 -0
  147. package/dist/core/apply.d.ts.map +1 -0
  148. package/dist/core/classifier.d.ts +88 -0
  149. package/dist/core/classifier.d.ts.map +1 -0
  150. package/dist/core/container.d.ts +45 -0
  151. package/dist/core/container.d.ts.map +1 -0
  152. package/dist/core/cursor.d.ts +67 -0
  153. package/dist/core/cursor.d.ts.map +1 -0
  154. package/dist/core/diff.d.ts +49 -0
  155. package/dist/core/diff.d.ts.map +1 -0
  156. package/dist/core/entity.d.ts +41 -0
  157. package/dist/core/entity.d.ts.map +1 -0
  158. package/dist/core/find-templates.d.ts +69 -0
  159. package/dist/core/find-templates.d.ts.map +1 -0
  160. package/dist/core/handoff.d.ts +36 -0
  161. package/dist/core/handoff.d.ts.map +1 -0
  162. package/dist/core/index.d.ts +61 -0
  163. package/dist/core/index.d.ts.map +1 -0
  164. package/dist/core/interpolation.d.ts +88 -0
  165. package/dist/core/interpolation.d.ts.map +1 -0
  166. package/dist/core/normalize.d.ts +18 -0
  167. package/dist/core/normalize.d.ts.map +1 -0
  168. package/dist/core/ownership.d.ts +60 -0
  169. package/dist/core/ownership.d.ts.map +1 -0
  170. package/dist/core/receipts.d.ts +28 -0
  171. package/dist/core/receipts.d.ts.map +1 -0
  172. package/dist/core/references.d.ts +37 -0
  173. package/dist/core/references.d.ts.map +1 -0
  174. package/dist/core/template.d.ts +41 -0
  175. package/dist/core/template.d.ts.map +1 -0
  176. package/dist/core/testing/http-stub.d.ts +17 -0
  177. package/dist/core/testing/http-stub.d.ts.map +1 -0
  178. package/dist/core/tokens.d.ts +102 -0
  179. package/dist/core/tokens.d.ts.map +1 -0
  180. package/dist/coverage.d.ts +25 -0
  181. package/dist/coverage.d.ts.map +1 -0
  182. package/dist/detect.d.ts +15 -0
  183. package/dist/detect.d.ts.map +1 -0
  184. package/dist/dialects.d.ts +20 -0
  185. package/dist/dialects.d.ts.map +1 -0
  186. package/dist/generated/clickhouse-types.d.ts +4380 -0
  187. package/dist/generated/clickhouse-types.d.ts.map +1 -0
  188. package/dist/generated/clickhouse.d.ts +11 -0
  189. package/dist/generated/clickhouse.d.ts.map +1 -0
  190. package/dist/generated/postgres-types.d.ts +1579 -0
  191. package/dist/generated/postgres-types.d.ts.map +1 -0
  192. package/dist/generated/postgres.d.ts +9 -0
  193. package/dist/generated/postgres.d.ts.map +1 -0
  194. package/dist/import-generator.d.ts +8 -0
  195. package/dist/import-generator.d.ts.map +1 -0
  196. package/dist/index.d.ts +7 -0
  197. package/dist/index.d.ts.map +1 -0
  198. package/dist/init-templates.d.ts +20 -0
  199. package/dist/init-templates.d.ts.map +1 -0
  200. package/dist/integrity.json +61 -0
  201. package/dist/lint/audit-catalog.d.ts +10 -0
  202. package/dist/lint/audit-catalog.d.ts.map +1 -0
  203. package/dist/lint/audit-lineage.d.ts +25 -0
  204. package/dist/lint/audit-lineage.d.ts.map +1 -0
  205. package/dist/lint/post-synth/audit-entries.d.ts +8 -0
  206. package/dist/lint/post-synth/audit-entries.d.ts.map +1 -0
  207. package/dist/lint/post-synth/clickhouse-helpers.d.ts +85 -0
  208. package/dist/lint/post-synth/clickhouse-helpers.d.ts.map +1 -0
  209. package/dist/lint/post-synth/index.d.ts +3 -0
  210. package/dist/lint/post-synth/index.d.ts.map +1 -0
  211. package/dist/lint/post-synth/postgres-audit-entries.d.ts +9 -0
  212. package/dist/lint/post-synth/postgres-audit-entries.d.ts.map +1 -0
  213. package/dist/lint/post-synth/postgres-helpers.d.ts +89 -0
  214. package/dist/lint/post-synth/postgres-helpers.d.ts.map +1 -0
  215. package/dist/lint/post-synth/sql-helpers.d.ts +27 -0
  216. package/dist/lint/post-synth/sql-helpers.d.ts.map +1 -0
  217. package/dist/lint/post-synth/sqlch101.d.ts +12 -0
  218. package/dist/lint/post-synth/sqlch101.d.ts.map +1 -0
  219. package/dist/lint/post-synth/sqlch102.d.ts +9 -0
  220. package/dist/lint/post-synth/sqlch102.d.ts.map +1 -0
  221. package/dist/lint/post-synth/sqlch103.d.ts +10 -0
  222. package/dist/lint/post-synth/sqlch103.d.ts.map +1 -0
  223. package/dist/lint/post-synth/sqlch104.d.ts +9 -0
  224. package/dist/lint/post-synth/sqlch104.d.ts.map +1 -0
  225. package/dist/lint/post-synth/sqlch105.d.ts +10 -0
  226. package/dist/lint/post-synth/sqlch105.d.ts.map +1 -0
  227. package/dist/lint/post-synth/sqlch106.d.ts +11 -0
  228. package/dist/lint/post-synth/sqlch106.d.ts.map +1 -0
  229. package/dist/lint/post-synth/sqlch107.d.ts +10 -0
  230. package/dist/lint/post-synth/sqlch107.d.ts.map +1 -0
  231. package/dist/lint/post-synth/sqlch108.d.ts +11 -0
  232. package/dist/lint/post-synth/sqlch108.d.ts.map +1 -0
  233. package/dist/lint/post-synth/sqlch109.d.ts +10 -0
  234. package/dist/lint/post-synth/sqlch109.d.ts.map +1 -0
  235. package/dist/lint/post-synth/sqlch110.d.ts +12 -0
  236. package/dist/lint/post-synth/sqlch110.d.ts.map +1 -0
  237. package/dist/lint/post-synth/sqlch111.d.ts +11 -0
  238. package/dist/lint/post-synth/sqlch111.d.ts.map +1 -0
  239. package/dist/lint/post-synth/sqlch112.d.ts +12 -0
  240. package/dist/lint/post-synth/sqlch112.d.ts.map +1 -0
  241. package/dist/lint/post-synth/sqlch113.d.ts +9 -0
  242. package/dist/lint/post-synth/sqlch113.d.ts.map +1 -0
  243. package/dist/lint/post-synth/sqlch114.d.ts +8 -0
  244. package/dist/lint/post-synth/sqlch114.d.ts.map +1 -0
  245. package/dist/lint/post-synth/sqlch115.d.ts +13 -0
  246. package/dist/lint/post-synth/sqlch115.d.ts.map +1 -0
  247. package/dist/lint/post-synth/sqlch116.d.ts +10 -0
  248. package/dist/lint/post-synth/sqlch116.d.ts.map +1 -0
  249. package/dist/lint/post-synth/sqlch117.d.ts +9 -0
  250. package/dist/lint/post-synth/sqlch117.d.ts.map +1 -0
  251. package/dist/lint/post-synth/sqlch118.d.ts +10 -0
  252. package/dist/lint/post-synth/sqlch118.d.ts.map +1 -0
  253. package/dist/lint/post-synth/sqlch119.d.ts +11 -0
  254. package/dist/lint/post-synth/sqlch119.d.ts.map +1 -0
  255. package/dist/lint/post-synth/sqlch120.d.ts +10 -0
  256. package/dist/lint/post-synth/sqlch120.d.ts.map +1 -0
  257. package/dist/lint/post-synth/sqlpg101.d.ts +12 -0
  258. package/dist/lint/post-synth/sqlpg101.d.ts.map +1 -0
  259. package/dist/lint/post-synth/sqlpg102.d.ts +11 -0
  260. package/dist/lint/post-synth/sqlpg102.d.ts.map +1 -0
  261. package/dist/lint/post-synth/sqlpg103.d.ts +11 -0
  262. package/dist/lint/post-synth/sqlpg103.d.ts.map +1 -0
  263. package/dist/lint/post-synth/sqlpg104.d.ts +10 -0
  264. package/dist/lint/post-synth/sqlpg104.d.ts.map +1 -0
  265. package/dist/lint/post-synth/sqlpg105.d.ts +10 -0
  266. package/dist/lint/post-synth/sqlpg105.d.ts.map +1 -0
  267. package/dist/lint/post-synth/sqlpg106.d.ts +9 -0
  268. package/dist/lint/post-synth/sqlpg106.d.ts.map +1 -0
  269. package/dist/lint/post-synth/sqlpg107.d.ts +10 -0
  270. package/dist/lint/post-synth/sqlpg107.d.ts.map +1 -0
  271. package/dist/lint/post-synth/sqlpg108.d.ts +11 -0
  272. package/dist/lint/post-synth/sqlpg108.d.ts.map +1 -0
  273. package/dist/lint/post-synth/sqlpg109.d.ts +11 -0
  274. package/dist/lint/post-synth/sqlpg109.d.ts.map +1 -0
  275. package/dist/lint/post-synth/sqlpg110.d.ts +12 -0
  276. package/dist/lint/post-synth/sqlpg110.d.ts.map +1 -0
  277. package/dist/lint/post-synth/sqlpg111.d.ts +10 -0
  278. package/dist/lint/post-synth/sqlpg111.d.ts.map +1 -0
  279. package/dist/lint/post-synth/sqlpg112.d.ts +10 -0
  280. package/dist/lint/post-synth/sqlpg112.d.ts.map +1 -0
  281. package/dist/lint/post-synth/sqlpg113.d.ts +11 -0
  282. package/dist/lint/post-synth/sqlpg113.d.ts.map +1 -0
  283. package/dist/lint/post-synth/sqlpg114.d.ts +13 -0
  284. package/dist/lint/post-synth/sqlpg114.d.ts.map +1 -0
  285. package/dist/lint/post-synth/sqlpg115.d.ts +13 -0
  286. package/dist/lint/post-synth/sqlpg115.d.ts.map +1 -0
  287. package/dist/lint/post-synth/sqlpg116.d.ts +11 -0
  288. package/dist/lint/post-synth/sqlpg116.d.ts.map +1 -0
  289. package/dist/lint/post-synth/sqlpg117.d.ts +12 -0
  290. package/dist/lint/post-synth/sqlpg117.d.ts.map +1 -0
  291. package/dist/lint/post-synth/sqlpg118.d.ts +12 -0
  292. package/dist/lint/post-synth/sqlpg118.d.ts.map +1 -0
  293. package/dist/lint/rules/index.d.ts +12 -0
  294. package/dist/lint/rules/index.d.ts.map +1 -0
  295. package/dist/lint/rules/postgres-templates.d.ts +18 -0
  296. package/dist/lint/rules/postgres-templates.d.ts.map +1 -0
  297. package/dist/lint/rules/sqlch001.d.ts +12 -0
  298. package/dist/lint/rules/sqlch001.d.ts.map +1 -0
  299. package/dist/lint/rules/sqlch002.d.ts +11 -0
  300. package/dist/lint/rules/sqlch002.d.ts.map +1 -0
  301. package/dist/lint/rules/sqlch003.d.ts +12 -0
  302. package/dist/lint/rules/sqlch003.d.ts.map +1 -0
  303. package/dist/lint/rules/sqlpg001.d.ts +16 -0
  304. package/dist/lint/rules/sqlpg001.d.ts.map +1 -0
  305. package/dist/lint/rules/sqlpg002.d.ts +12 -0
  306. package/dist/lint/rules/sqlpg002.d.ts.map +1 -0
  307. package/dist/lint/rules/sqlpg003.d.ts +16 -0
  308. package/dist/lint/rules/sqlpg003.d.ts.map +1 -0
  309. package/dist/lint/rules/sqlpg004.d.ts +21 -0
  310. package/dist/lint/rules/sqlpg004.d.ts.map +1 -0
  311. package/dist/lint/rules/templates.d.ts +23 -0
  312. package/dist/lint/rules/templates.d.ts.map +1 -0
  313. package/dist/live-dialect.d.ts +25 -0
  314. package/dist/live-dialect.d.ts.map +1 -0
  315. package/dist/lsp/catalog.d.ts +22 -0
  316. package/dist/lsp/catalog.d.ts.map +1 -0
  317. package/dist/lsp/completions.d.ts +13 -0
  318. package/dist/lsp/completions.d.ts.map +1 -0
  319. package/dist/lsp/hover.d.ts +12 -0
  320. package/dist/lsp/hover.d.ts.map +1 -0
  321. package/dist/lsp/postgres-catalog.d.ts +85 -0
  322. package/dist/lsp/postgres-catalog.d.ts.map +1 -0
  323. package/dist/lsp/postgres-template.d.ts +35 -0
  324. package/dist/lsp/postgres-template.d.ts.map +1 -0
  325. package/dist/lsp/postgres.d.ts +20 -0
  326. package/dist/lsp/postgres.d.ts.map +1 -0
  327. package/dist/lsp/refs.d.ts +8 -0
  328. package/dist/lsp/refs.d.ts.map +1 -0
  329. package/dist/lsp/registry.d.ts +4 -0
  330. package/dist/lsp/registry.d.ts.map +1 -0
  331. package/dist/lsp/template.d.ts +34 -0
  332. package/dist/lsp/template.d.ts.map +1 -0
  333. package/dist/manifest.json +8 -0
  334. package/dist/mcp/index.d.ts +13 -0
  335. package/dist/mcp/index.d.ts.map +1 -0
  336. package/dist/mcp/postgres.d.ts +32 -0
  337. package/dist/mcp/postgres.d.ts.map +1 -0
  338. package/dist/meta.json +67 -0
  339. package/dist/okf/index.md +67 -0
  340. package/dist/okf/rules/SQLCH001.md +11 -0
  341. package/dist/okf/rules/SQLCH002.md +11 -0
  342. package/dist/okf/rules/SQLCH003.md +11 -0
  343. package/dist/okf/rules/SQLCH101.md +15 -0
  344. package/dist/okf/rules/SQLCH102.md +11 -0
  345. package/dist/okf/rules/SQLCH103.md +11 -0
  346. package/dist/okf/rules/SQLCH104.md +11 -0
  347. package/dist/okf/rules/SQLCH105.md +11 -0
  348. package/dist/okf/rules/SQLCH106.md +11 -0
  349. package/dist/okf/rules/SQLCH107.md +11 -0
  350. package/dist/okf/rules/SQLCH108.md +15 -0
  351. package/dist/okf/rules/SQLCH109.md +11 -0
  352. package/dist/okf/rules/SQLCH110.md +11 -0
  353. package/dist/okf/rules/SQLCH111.md +11 -0
  354. package/dist/okf/rules/SQLCH112.md +11 -0
  355. package/dist/okf/rules/SQLCH113.md +11 -0
  356. package/dist/okf/rules/SQLCH114.md +11 -0
  357. package/dist/okf/rules/SQLCH115.md +11 -0
  358. package/dist/okf/rules/SQLCH116.md +11 -0
  359. package/dist/okf/rules/SQLCH117.md +15 -0
  360. package/dist/okf/rules/SQLCH118.md +15 -0
  361. package/dist/okf/rules/SQLCH119.md +15 -0
  362. package/dist/okf/rules/SQLCH120.md +15 -0
  363. package/dist/okf/rules/SQLPG001.md +11 -0
  364. package/dist/okf/rules/SQLPG002.md +11 -0
  365. package/dist/okf/rules/SQLPG003.md +11 -0
  366. package/dist/okf/rules/SQLPG004.md +11 -0
  367. package/dist/okf/rules/SQLPG101.md +11 -0
  368. package/dist/okf/rules/SQLPG102.md +11 -0
  369. package/dist/okf/rules/SQLPG103.md +11 -0
  370. package/dist/okf/rules/SQLPG104.md +11 -0
  371. package/dist/okf/rules/SQLPG105.md +11 -0
  372. package/dist/okf/rules/SQLPG106.md +11 -0
  373. package/dist/okf/rules/SQLPG107.md +11 -0
  374. package/dist/okf/rules/SQLPG108.md +11 -0
  375. package/dist/okf/rules/SQLPG109.md +11 -0
  376. package/dist/okf/rules/SQLPG110.md +11 -0
  377. package/dist/okf/rules/SQLPG111.md +11 -0
  378. package/dist/okf/rules/SQLPG112.md +11 -0
  379. package/dist/okf/rules/SQLPG113.md +24 -0
  380. package/dist/okf/rules/SQLPG114.md +11 -0
  381. package/dist/okf/rules/SQLPG115.md +11 -0
  382. package/dist/okf/rules/SQLPG116.md +15 -0
  383. package/dist/okf/rules/SQLPG117.md +11 -0
  384. package/dist/okf/rules/SQLPG118.md +11 -0
  385. package/dist/okf/types/Database.md +15 -0
  386. package/dist/okf/types/MaterializedView.md +14 -0
  387. package/dist/okf/types/PostgresDomain.md +13 -0
  388. package/dist/okf/types/PostgresEnum.md +13 -0
  389. package/dist/okf/types/PostgresExtension.md +13 -0
  390. package/dist/okf/types/PostgresIndex.md +9 -0
  391. package/dist/okf/types/PostgresMaterializedView.md +13 -0
  392. package/dist/okf/types/PostgresSchema.md +13 -0
  393. package/dist/okf/types/PostgresSequence.md +13 -0
  394. package/dist/okf/types/PostgresTable.md +13 -0
  395. package/dist/okf/types/PostgresView.md +13 -0
  396. package/dist/okf/types/Table.md +15 -0
  397. package/dist/okf/types/View.md +13 -0
  398. package/dist/op/activities/clickhouse-apply.d.ts +56 -0
  399. package/dist/op/activities/clickhouse-apply.d.ts.map +1 -0
  400. package/dist/op/activities/clickhouse-emulator.d.ts +26 -0
  401. package/dist/op/activities/clickhouse-emulator.d.ts.map +1 -0
  402. package/dist/op/activities/clickhouse-rebuild.d.ts +43 -0
  403. package/dist/op/activities/clickhouse-rebuild.d.ts.map +1 -0
  404. package/dist/op/activities/index.d.ts +19 -0
  405. package/dist/op/activities/index.d.ts.map +1 -0
  406. package/dist/op/activities/postgres-apply.d.ts +69 -0
  407. package/dist/op/activities/postgres-apply.d.ts.map +1 -0
  408. package/dist/op/activities/postgres-emulator.d.ts +33 -0
  409. package/dist/op/activities/postgres-emulator.d.ts.map +1 -0
  410. package/dist/op/activities/postgres-migration.d.ts +48 -0
  411. package/dist/op/activities/postgres-migration.d.ts.map +1 -0
  412. package/dist/op/activity-contracts.d.ts +464 -0
  413. package/dist/op/activity-contracts.d.ts.map +1 -0
  414. package/dist/package-cli.d.ts +3 -0
  415. package/dist/package-cli.d.ts.map +1 -0
  416. package/dist/plugin.d.ts +12 -0
  417. package/dist/plugin.d.ts.map +1 -0
  418. package/dist/postgres/apply/apply.d.ts +163 -0
  419. package/dist/postgres/apply/apply.d.ts.map +1 -0
  420. package/dist/postgres/apply/statements.d.ts +138 -0
  421. package/dist/postgres/apply/statements.d.ts.map +1 -0
  422. package/dist/postgres/catalog-types.d.ts +50 -0
  423. package/dist/postgres/catalog-types.d.ts.map +1 -0
  424. package/dist/postgres/container.d.ts +23 -0
  425. package/dist/postgres/container.d.ts.map +1 -0
  426. package/dist/postgres/entities.d.ts +322 -0
  427. package/dist/postgres/entities.d.ts.map +1 -0
  428. package/dist/postgres/entity-types.d.ts +17 -0
  429. package/dist/postgres/entity-types.d.ts.map +1 -0
  430. package/dist/postgres/import/generator.d.ts +28 -0
  431. package/dist/postgres/import/generator.d.ts.map +1 -0
  432. package/dist/postgres/import/ir.d.ts +24 -0
  433. package/dist/postgres/import/ir.d.ts.map +1 -0
  434. package/dist/postgres/import/live-export.d.ts +26 -0
  435. package/dist/postgres/import/live-export.d.ts.map +1 -0
  436. package/dist/postgres/keywords.d.ts +22 -0
  437. package/dist/postgres/keywords.d.ts.map +1 -0
  438. package/dist/postgres/live/bind.d.ts +76 -0
  439. package/dist/postgres/live/bind.d.ts.map +1 -0
  440. package/dist/postgres/live/catalog.d.ts +98 -0
  441. package/dist/postgres/live/catalog.d.ts.map +1 -0
  442. package/dist/postgres/live/client.d.ts +32 -0
  443. package/dist/postgres/live/client.d.ts.map +1 -0
  444. package/dist/postgres/live/describe-resources.d.ts +41 -0
  445. package/dist/postgres/live/describe-resources.d.ts.map +1 -0
  446. package/dist/postgres/migrate/backfill.d.ts +103 -0
  447. package/dist/postgres/migrate/backfill.d.ts.map +1 -0
  448. package/dist/postgres/migrate/batches.d.ts +90 -0
  449. package/dist/postgres/migrate/batches.d.ts.map +1 -0
  450. package/dist/postgres/migrate/carry.d.ts +196 -0
  451. package/dist/postgres/migrate/carry.d.ts.map +1 -0
  452. package/dist/postgres/migrate/handoff.d.ts +46 -0
  453. package/dist/postgres/migrate/handoff.d.ts.map +1 -0
  454. package/dist/postgres/migrate/names.d.ts +55 -0
  455. package/dist/postgres/migrate/names.d.ts.map +1 -0
  456. package/dist/postgres/migrate/observe.d.ts +139 -0
  457. package/dist/postgres/migrate/observe.d.ts.map +1 -0
  458. package/dist/postgres/migrate/op.d.ts +128 -0
  459. package/dist/postgres/migrate/op.d.ts.map +1 -0
  460. package/dist/postgres/migrate/receipts.d.ts +63 -0
  461. package/dist/postgres/migrate/receipts.d.ts.map +1 -0
  462. package/dist/postgres/migrate/replication.d.ts +80 -0
  463. package/dist/postgres/migrate/replication.d.ts.map +1 -0
  464. package/dist/postgres/migrate/steps.d.ts +225 -0
  465. package/dist/postgres/migrate/steps.d.ts.map +1 -0
  466. package/dist/postgres/overlays/columns.d.ts +6 -0
  467. package/dist/postgres/overlays/columns.d.ts.map +1 -0
  468. package/dist/postgres/overlays/constraints.d.ts +8 -0
  469. package/dist/postgres/overlays/constraints.d.ts.map +1 -0
  470. package/dist/postgres/overlays/indexes.d.ts +8 -0
  471. package/dist/postgres/overlays/indexes.d.ts.map +1 -0
  472. package/dist/postgres/overlays/kinds.d.ts +48 -0
  473. package/dist/postgres/overlays/kinds.d.ts.map +1 -0
  474. package/dist/postgres/overlays/partitioning.d.ts +5 -0
  475. package/dist/postgres/overlays/partitioning.d.ts.map +1 -0
  476. package/dist/postgres/overlays/relations.d.ts +6 -0
  477. package/dist/postgres/overlays/relations.d.ts.map +1 -0
  478. package/dist/postgres/overlays/storage.d.ts +28 -0
  479. package/dist/postgres/overlays/storage.d.ts.map +1 -0
  480. package/dist/postgres/overlays/type-ddl.d.ts +7 -0
  481. package/dist/postgres/overlays/type-ddl.d.ts.map +1 -0
  482. package/dist/postgres/overlays/types.d.ts +24 -0
  483. package/dist/postgres/overlays/types.d.ts.map +1 -0
  484. package/dist/postgres/parser.d.ts +216 -0
  485. package/dist/postgres/parser.d.ts.map +1 -0
  486. package/dist/postgres/plan/commands.d.ts +61 -0
  487. package/dist/postgres/plan/commands.d.ts.map +1 -0
  488. package/dist/postgres/plan/deep.d.ts +33 -0
  489. package/dist/postgres/plan/deep.d.ts.map +1 -0
  490. package/dist/postgres/plan/diff.d.ts +45 -0
  491. package/dist/postgres/plan/diff.d.ts.map +1 -0
  492. package/dist/postgres/plan/disruption.d.ts +14 -0
  493. package/dist/postgres/plan/disruption.d.ts.map +1 -0
  494. package/dist/postgres/plan/normalize.d.ts +108 -0
  495. package/dist/postgres/plan/normalize.d.ts.map +1 -0
  496. package/dist/postgres/plan/report.d.ts +6 -0
  497. package/dist/postgres/plan/report.d.ts.map +1 -0
  498. package/dist/postgres/plan/rules.d.ts +84 -0
  499. package/dist/postgres/plan/rules.d.ts.map +1 -0
  500. package/dist/postgres/plan/schema.d.ts +50 -0
  501. package/dist/postgres/plan/schema.d.ts.map +1 -0
  502. package/dist/postgres/plan/server-normalize.d.ts +26 -0
  503. package/dist/postgres/plan/server-normalize.d.ts.map +1 -0
  504. package/dist/postgres/providers/aurora.d.ts +12 -0
  505. package/dist/postgres/providers/aurora.d.ts.map +1 -0
  506. package/dist/postgres/providers/azure.d.ts +14 -0
  507. package/dist/postgres/providers/azure.d.ts.map +1 -0
  508. package/dist/postgres/providers/cloud-sql.d.ts +11 -0
  509. package/dist/postgres/providers/cloud-sql.d.ts.map +1 -0
  510. package/dist/postgres/providers/index.d.ts +35 -0
  511. package/dist/postgres/providers/index.d.ts.map +1 -0
  512. package/dist/postgres/providers/neon.d.ts +13 -0
  513. package/dist/postgres/providers/neon.d.ts.map +1 -0
  514. package/dist/postgres/providers/rds.d.ts +10 -0
  515. package/dist/postgres/providers/rds.d.ts.map +1 -0
  516. package/dist/postgres/providers/supabase.d.ts +12 -0
  517. package/dist/postgres/providers/supabase.d.ts.map +1 -0
  518. package/dist/postgres/providers/types.d.ts +59 -0
  519. package/dist/postgres/providers/types.d.ts.map +1 -0
  520. package/dist/postgres/testing/fake-client.d.ts +38 -0
  521. package/dist/postgres/testing/fake-client.d.ts.map +1 -0
  522. package/dist/postgres/testing/migration.d.ts +25 -0
  523. package/dist/postgres/testing/migration.d.ts.map +1 -0
  524. package/dist/postgres/testing/roundtrip-schema.d.ts +11 -0
  525. package/dist/postgres/testing/roundtrip-schema.d.ts.map +1 -0
  526. package/dist/postgres/testing/server.d.ts +17 -0
  527. package/dist/postgres/testing/server.d.ts.map +1 -0
  528. package/dist/postgres/testing/writable-server.d.ts +45 -0
  529. package/dist/postgres/testing/writable-server.d.ts.map +1 -0
  530. package/dist/postgres/tokens.d.ts +26 -0
  531. package/dist/postgres/tokens.d.ts.map +1 -0
  532. package/dist/postgres.d.ts +13 -0
  533. package/dist/postgres.d.ts.map +1 -0
  534. package/dist/rules/audit-entries.ts +29 -0
  535. package/dist/rules/clickhouse-helpers.ts +206 -0
  536. package/dist/rules/postgres-audit-entries.ts +29 -0
  537. package/dist/rules/postgres-helpers.ts +126 -0
  538. package/dist/rules/postgres-templates.ts +36 -0
  539. package/dist/rules/sql-helpers.ts +53 -0
  540. package/dist/rules/sqlch001.ts +53 -0
  541. package/dist/rules/sqlch002.ts +115 -0
  542. package/dist/rules/sqlch003.ts +68 -0
  543. package/dist/rules/sqlch101.ts +35 -0
  544. package/dist/rules/sqlch102.ts +23 -0
  545. package/dist/rules/sqlch103.ts +45 -0
  546. package/dist/rules/sqlch104.ts +42 -0
  547. package/dist/rules/sqlch105.ts +35 -0
  548. package/dist/rules/sqlch106.ts +27 -0
  549. package/dist/rules/sqlch107.ts +35 -0
  550. package/dist/rules/sqlch108.ts +27 -0
  551. package/dist/rules/sqlch109.ts +21 -0
  552. package/dist/rules/sqlch110.ts +29 -0
  553. package/dist/rules/sqlch111.ts +40 -0
  554. package/dist/rules/sqlch112.ts +30 -0
  555. package/dist/rules/sqlch113.ts +20 -0
  556. package/dist/rules/sqlch114.ts +26 -0
  557. package/dist/rules/sqlch115.ts +31 -0
  558. package/dist/rules/sqlch116.ts +22 -0
  559. package/dist/rules/sqlch117.ts +25 -0
  560. package/dist/rules/sqlch118.ts +26 -0
  561. package/dist/rules/sqlch119.ts +31 -0
  562. package/dist/rules/sqlch120.ts +21 -0
  563. package/dist/rules/sqlpg001.ts +88 -0
  564. package/dist/rules/sqlpg002.ts +68 -0
  565. package/dist/rules/sqlpg003.ts +59 -0
  566. package/dist/rules/sqlpg004.ts +73 -0
  567. package/dist/rules/sqlpg101.ts +24 -0
  568. package/dist/rules/sqlpg102.ts +30 -0
  569. package/dist/rules/sqlpg103.ts +23 -0
  570. package/dist/rules/sqlpg104.ts +23 -0
  571. package/dist/rules/sqlpg105.ts +22 -0
  572. package/dist/rules/sqlpg106.ts +22 -0
  573. package/dist/rules/sqlpg107.ts +22 -0
  574. package/dist/rules/sqlpg108.ts +27 -0
  575. package/dist/rules/sqlpg109.ts +37 -0
  576. package/dist/rules/sqlpg110.ts +33 -0
  577. package/dist/rules/sqlpg111.ts +23 -0
  578. package/dist/rules/sqlpg112.ts +25 -0
  579. package/dist/rules/sqlpg113.ts +28 -0
  580. package/dist/rules/sqlpg114.ts +37 -0
  581. package/dist/rules/sqlpg115.ts +38 -0
  582. package/dist/rules/sqlpg116.ts +25 -0
  583. package/dist/rules/sqlpg117.ts +24 -0
  584. package/dist/rules/sqlpg118.ts +22 -0
  585. package/dist/rules/templates.ts +35 -0
  586. package/dist/serializer.d.ts +37 -0
  587. package/dist/serializer.d.ts.map +1 -0
  588. package/dist/skill-defs.d.ts +3 -0
  589. package/dist/skill-defs.d.ts.map +1 -0
  590. package/dist/spec/catalog.d.ts +125 -0
  591. package/dist/spec/catalog.d.ts.map +1 -0
  592. package/dist/spec/fetch.d.ts +43 -0
  593. package/dist/spec/fetch.d.ts.map +1 -0
  594. package/dist/spec/pin.d.ts +39 -0
  595. package/dist/spec/pin.d.ts.map +1 -0
  596. package/dist/spec/postgres-catalog.d.ts +108 -0
  597. package/dist/spec/postgres-catalog.d.ts.map +1 -0
  598. package/dist/spec/postgres-fetch.d.ts +46 -0
  599. package/dist/spec/postgres-fetch.d.ts.map +1 -0
  600. package/dist/spec/postgres-pin.d.ts +67 -0
  601. package/dist/spec/postgres-pin.d.ts.map +1 -0
  602. package/dist/types/index.d.ts +4386 -0
  603. package/dist/validate-cli.d.ts +3 -0
  604. package/dist/validate-cli.d.ts.map +1 -0
  605. package/dist/validate.d.ts +15 -0
  606. package/dist/validate.d.ts.map +1 -0
  607. package/package.json +74 -4
  608. package/src/clickhouse/apply/apply.ts +288 -0
  609. package/src/clickhouse/apply/mutations.ts +90 -0
  610. package/src/clickhouse/apply/statements.ts +393 -0
  611. package/src/clickhouse/catalog-types.ts +84 -0
  612. package/src/clickhouse/container.ts +176 -0
  613. package/src/clickhouse/engine-syntax.test.ts +53 -0
  614. package/src/clickhouse/engine-syntax.ts +173 -0
  615. package/src/clickhouse/entities.test.ts +188 -0
  616. package/src/clickhouse/entities.ts +425 -0
  617. package/src/clickhouse/http.ts +76 -0
  618. package/src/clickhouse/import/generator.ts +153 -0
  619. package/src/clickhouse/import/import.test.ts +157 -0
  620. package/src/clickhouse/import/ir.ts +171 -0
  621. package/src/clickhouse/import/live-export.ts +53 -0
  622. package/src/clickhouse/import/parser.ts +27 -0
  623. package/src/clickhouse/import/roundtrip.test.ts +90 -0
  624. package/src/clickhouse/live/bind.ts +126 -0
  625. package/src/clickhouse/live/catalog.ts +96 -0
  626. package/src/clickhouse/live/describe-resources.ts +98 -0
  627. package/src/clickhouse/live/live.test.ts +143 -0
  628. package/src/clickhouse/live/roundtrip.e2e.test.ts +93 -0
  629. package/src/clickhouse/overlays/codecs.ts +68 -0
  630. package/src/clickhouse/overlays/engines.ts +108 -0
  631. package/src/clickhouse/overlays/kinds.ts +38 -0
  632. package/src/clickhouse/overlays/projections.ts +36 -0
  633. package/src/clickhouse/overlays/skip-indexes.ts +44 -0
  634. package/src/clickhouse/overlays/ttl.ts +55 -0
  635. package/src/clickhouse/overlays/types.ts +58 -0
  636. package/src/clickhouse/ownership.test.ts +20 -0
  637. package/src/clickhouse/ownership.ts +103 -0
  638. package/src/clickhouse/parser.test.ts +166 -0
  639. package/src/clickhouse/parser.ts +459 -0
  640. package/src/clickhouse/plan/commands.ts +101 -0
  641. package/src/clickhouse/plan/deep.ts +124 -0
  642. package/src/clickhouse/plan/diff.ts +203 -0
  643. package/src/clickhouse/plan/disruption.ts +61 -0
  644. package/src/clickhouse/plan/normalize.ts +352 -0
  645. package/src/clickhouse/plan/plan-wiring.test.ts +77 -0
  646. package/src/clickhouse/plan/plan.e2e.test.ts +77 -0
  647. package/src/clickhouse/plan/plan.test.ts +201 -0
  648. package/src/clickhouse/plan/rebuild-handoff.ts +59 -0
  649. package/src/clickhouse/plan/report.ts +19 -0
  650. package/src/clickhouse/plan/rules.ts +241 -0
  651. package/src/clickhouse/plan/schema.ts +56 -0
  652. package/src/clickhouse/plan/server-format.ts +39 -0
  653. package/src/clickhouse/rebuild/backfill.ts +186 -0
  654. package/src/clickhouse/rebuild/observe.ts +380 -0
  655. package/src/clickhouse/rebuild/op.ts +206 -0
  656. package/src/clickhouse/rebuild/partitions.ts +62 -0
  657. package/src/clickhouse/rebuild/rebuild-replicated.e2e.test.ts +513 -0
  658. package/src/clickhouse/rebuild/rebuild.e2e.test.ts +351 -0
  659. package/src/clickhouse/rebuild/rebuild.test.ts +190 -0
  660. package/src/clickhouse/rebuild/receipts.ts +143 -0
  661. package/src/clickhouse/rebuild/replicas.test.ts +70 -0
  662. package/src/clickhouse/rebuild/replicas.ts +148 -0
  663. package/src/clickhouse/rebuild/steps.ts +382 -0
  664. package/src/clickhouse/rebuild/verify.ts +124 -0
  665. package/src/clickhouse/testdata/NOTICE +5 -0
  666. package/src/clickhouse/testdata/clickhouse-tests-corpus.json +302 -0
  667. package/src/clickhouse/testing/fake-server.ts +65 -0
  668. package/src/clickhouse/testing/roundtrip-schema.ts +25 -0
  669. package/src/clickhouse/testing/writable-server.ts +141 -0
  670. package/src/clickhouse/tokens.ts +28 -0
  671. package/src/clickhouse.ts +63 -0
  672. package/src/codegen/classifier-page.test.ts +16 -0
  673. package/src/codegen/classifier-page.ts +76 -0
  674. package/src/codegen/clickhouse-module.test.ts +63 -0
  675. package/src/codegen/clickhouse-module.ts +269 -0
  676. package/src/codegen/docs-cli.ts +4 -0
  677. package/src/codegen/docs.ts +225 -0
  678. package/src/codegen/generate-cli.ts +13 -0
  679. package/src/codegen/generate.ts +126 -0
  680. package/src/codegen/package.ts +36 -0
  681. package/src/codegen/postgres-classifier-page.ts +81 -0
  682. package/src/codegen/postgres-module.test.ts +77 -0
  683. package/src/codegen/postgres-module.ts +434 -0
  684. package/src/codegen/registry.ts +36 -0
  685. package/src/composites/audit-log-table.ts +54 -0
  686. package/src/composites/catalog.test.ts +61 -0
  687. package/src/composites/catalog.ts +529 -0
  688. package/src/composites/cdc-mirror.ts +54 -0
  689. package/src/composites/clickhouse.ts +7 -0
  690. package/src/composites/composites.test.ts +758 -0
  691. package/src/composites/events-table.ts +49 -0
  692. package/src/composites/index.ts +9 -0
  693. package/src/composites/join-table.ts +57 -0
  694. package/src/composites/postgres.ts +7 -0
  695. package/src/composites/refreshed-view.ts +46 -0
  696. package/src/composites/replacing-table.ts +49 -0
  697. package/src/composites/rollup-view.ts +55 -0
  698. package/src/composites/sharded-table.ts +49 -0
  699. package/src/composites/soft-delete-table.ts +61 -0
  700. package/src/composites/tenant-table.ts +50 -0
  701. package/src/config.ts +157 -0
  702. package/src/core/apply.ts +153 -0
  703. package/src/core/classifier.ts +186 -0
  704. package/src/core/container.ts +93 -0
  705. package/src/core/core.test.ts +254 -0
  706. package/src/core/cursor.ts +189 -0
  707. package/src/core/diff.ts +72 -0
  708. package/src/core/entity.ts +85 -0
  709. package/src/core/find-templates.ts +158 -0
  710. package/src/core/handoff.ts +44 -0
  711. package/src/core/index.ts +61 -0
  712. package/src/core/interpolation.ts +225 -0
  713. package/src/core/normalize.ts +39 -0
  714. package/src/core/ownership.test.ts +36 -0
  715. package/src/core/ownership.ts +133 -0
  716. package/src/core/receipts.ts +29 -0
  717. package/src/core/references.ts +74 -0
  718. package/src/core/template.ts +83 -0
  719. package/src/core/testing/http-stub.ts +33 -0
  720. package/src/core/tokens.ts +252 -0
  721. package/src/coverage.ts +64 -0
  722. package/src/detect.ts +32 -0
  723. package/src/dialects.ts +21 -0
  724. package/src/generated/clickhouse-types.ts +4386 -0
  725. package/src/generated/clickhouse.ts +2476 -0
  726. package/src/generated/index.d.ts +4386 -0
  727. package/src/generated/lexicon-sql.json +67 -0
  728. package/src/generated/postgres-types.ts +1190 -0
  729. package/src/generated/postgres.ts +1039 -0
  730. package/src/import-generator.ts +18 -0
  731. package/src/index.ts +21 -0
  732. package/src/init-templates.test.ts +108 -0
  733. package/src/init-templates.ts +327 -0
  734. package/src/lint/audit-catalog.ts +73 -0
  735. package/src/lint/audit-lineage.ts +47 -0
  736. package/src/lint/post-synth/audit-entries.ts +29 -0
  737. package/src/lint/post-synth/clickhouse-checks.test.ts +278 -0
  738. package/src/lint/post-synth/clickhouse-helpers.ts +206 -0
  739. package/src/lint/post-synth/index.ts +81 -0
  740. package/src/lint/post-synth/post-synth.test.ts +33 -0
  741. package/src/lint/post-synth/postgres-audit-entries.ts +29 -0
  742. package/src/lint/post-synth/postgres-checks.test.ts +257 -0
  743. package/src/lint/post-synth/postgres-helpers.ts +126 -0
  744. package/src/lint/post-synth/sql-helpers.ts +53 -0
  745. package/src/lint/post-synth/sqlch101.ts +35 -0
  746. package/src/lint/post-synth/sqlch102.ts +23 -0
  747. package/src/lint/post-synth/sqlch103.ts +45 -0
  748. package/src/lint/post-synth/sqlch104.ts +42 -0
  749. package/src/lint/post-synth/sqlch105.ts +35 -0
  750. package/src/lint/post-synth/sqlch106.ts +27 -0
  751. package/src/lint/post-synth/sqlch107.ts +35 -0
  752. package/src/lint/post-synth/sqlch108.ts +27 -0
  753. package/src/lint/post-synth/sqlch109.ts +21 -0
  754. package/src/lint/post-synth/sqlch110.ts +29 -0
  755. package/src/lint/post-synth/sqlch111.ts +40 -0
  756. package/src/lint/post-synth/sqlch112.ts +30 -0
  757. package/src/lint/post-synth/sqlch113.ts +20 -0
  758. package/src/lint/post-synth/sqlch114.ts +26 -0
  759. package/src/lint/post-synth/sqlch115.ts +31 -0
  760. package/src/lint/post-synth/sqlch116.ts +22 -0
  761. package/src/lint/post-synth/sqlch117.ts +25 -0
  762. package/src/lint/post-synth/sqlch118.ts +26 -0
  763. package/src/lint/post-synth/sqlch119.ts +31 -0
  764. package/src/lint/post-synth/sqlch120.ts +21 -0
  765. package/src/lint/post-synth/sqlpg101.ts +24 -0
  766. package/src/lint/post-synth/sqlpg102.ts +30 -0
  767. package/src/lint/post-synth/sqlpg103.ts +23 -0
  768. package/src/lint/post-synth/sqlpg104.ts +23 -0
  769. package/src/lint/post-synth/sqlpg105.ts +22 -0
  770. package/src/lint/post-synth/sqlpg106.ts +22 -0
  771. package/src/lint/post-synth/sqlpg107.ts +22 -0
  772. package/src/lint/post-synth/sqlpg108.ts +27 -0
  773. package/src/lint/post-synth/sqlpg109.ts +37 -0
  774. package/src/lint/post-synth/sqlpg110.ts +33 -0
  775. package/src/lint/post-synth/sqlpg111.ts +23 -0
  776. package/src/lint/post-synth/sqlpg112.ts +25 -0
  777. package/src/lint/post-synth/sqlpg113.ts +28 -0
  778. package/src/lint/post-synth/sqlpg114.ts +37 -0
  779. package/src/lint/post-synth/sqlpg115.ts +38 -0
  780. package/src/lint/post-synth/sqlpg116.ts +25 -0
  781. package/src/lint/post-synth/sqlpg117.ts +24 -0
  782. package/src/lint/post-synth/sqlpg118.ts +22 -0
  783. package/src/lint/rules/index.ts +13 -0
  784. package/src/lint/rules/postgres-templates.ts +36 -0
  785. package/src/lint/rules/rules.test.ts +228 -0
  786. package/src/lint/rules/sqlch001.ts +53 -0
  787. package/src/lint/rules/sqlch002.ts +115 -0
  788. package/src/lint/rules/sqlch003.ts +68 -0
  789. package/src/lint/rules/sqlpg001.ts +88 -0
  790. package/src/lint/rules/sqlpg002.ts +68 -0
  791. package/src/lint/rules/sqlpg003.ts +59 -0
  792. package/src/lint/rules/sqlpg004.ts +73 -0
  793. package/src/lint/rules/templates.ts +35 -0
  794. package/src/live-dialect.ts +37 -0
  795. package/src/lsp/catalog.ts +60 -0
  796. package/src/lsp/completions.test.ts +111 -0
  797. package/src/lsp/completions.ts +128 -0
  798. package/src/lsp/diagnostics.test.ts +26 -0
  799. package/src/lsp/hover.test.ts +90 -0
  800. package/src/lsp/hover.ts +113 -0
  801. package/src/lsp/postgres-catalog.ts +234 -0
  802. package/src/lsp/postgres-template.ts +161 -0
  803. package/src/lsp/postgres.test.ts +150 -0
  804. package/src/lsp/postgres.ts +270 -0
  805. package/src/lsp/refs.ts +53 -0
  806. package/src/lsp/registry.ts +19 -0
  807. package/src/lsp/template.ts +166 -0
  808. package/src/mcp/index.ts +304 -0
  809. package/src/mcp/mcp.test.ts +184 -0
  810. package/src/mcp/postgres.ts +125 -0
  811. package/src/op/activities/clickhouse-apply.e2e.test.ts +150 -0
  812. package/src/op/activities/clickhouse-apply.test.ts +265 -0
  813. package/src/op/activities/clickhouse-apply.ts +113 -0
  814. package/src/op/activities/clickhouse-emulator.test.ts +23 -0
  815. package/src/op/activities/clickhouse-emulator.ts +37 -0
  816. package/src/op/activities/clickhouse-rebuild.ts +136 -0
  817. package/src/op/activities/index.ts +50 -0
  818. package/src/op/activities/postgres-apply.e2e.test.ts +184 -0
  819. package/src/op/activities/postgres-apply.test.ts +304 -0
  820. package/src/op/activities/postgres-apply.ts +170 -0
  821. package/src/op/activities/postgres-emulator.test.ts +26 -0
  822. package/src/op/activities/postgres-emulator.ts +44 -0
  823. package/src/op/activities/postgres-migration.ts +182 -0
  824. package/src/op/activity-contracts.ts +210 -0
  825. package/src/package-cli.ts +17 -0
  826. package/src/plugin.test.ts +74 -0
  827. package/src/plugin.ts +242 -0
  828. package/src/postgres/apply/apply.ts +582 -0
  829. package/src/postgres/apply/statements.test.ts +155 -0
  830. package/src/postgres/apply/statements.ts +603 -0
  831. package/src/postgres/catalog-types.ts +59 -0
  832. package/src/postgres/container.ts +72 -0
  833. package/src/postgres/entities.test.ts +170 -0
  834. package/src/postgres/entities.ts +1016 -0
  835. package/src/postgres/entity-types.ts +18 -0
  836. package/src/postgres/import/generator.ts +176 -0
  837. package/src/postgres/import/import.test.ts +71 -0
  838. package/src/postgres/import/ir.ts +67 -0
  839. package/src/postgres/import/live-export.ts +53 -0
  840. package/src/postgres/import/live-warnings.test.ts +45 -0
  841. package/src/postgres/keywords.ts +40 -0
  842. package/src/postgres/live/bind.ts +146 -0
  843. package/src/postgres/live/catalog.ts +581 -0
  844. package/src/postgres/live/client.ts +84 -0
  845. package/src/postgres/live/describe-resources.ts +111 -0
  846. package/src/postgres/live/live.test.ts +198 -0
  847. package/src/postgres/live/roundtrip.e2e.test.ts +111 -0
  848. package/src/postgres/migrate/backfill.ts +233 -0
  849. package/src/postgres/migrate/batches.e2e.test.ts +163 -0
  850. package/src/postgres/migrate/batches.test.ts +36 -0
  851. package/src/postgres/migrate/batches.ts +159 -0
  852. package/src/postgres/migrate/carry.e2e.test.ts +335 -0
  853. package/src/postgres/migrate/carry.test.ts +103 -0
  854. package/src/postgres/migrate/carry.ts +653 -0
  855. package/src/postgres/migrate/handoff.ts +73 -0
  856. package/src/postgres/migrate/kinds.e2e.test.ts +204 -0
  857. package/src/postgres/migrate/migrate.e2e.test.ts +362 -0
  858. package/src/postgres/migrate/migrate.test.ts +322 -0
  859. package/src/postgres/migrate/names.ts +93 -0
  860. package/src/postgres/migrate/observe.ts +521 -0
  861. package/src/postgres/migrate/op.ts +242 -0
  862. package/src/postgres/migrate/receipts.ts +135 -0
  863. package/src/postgres/migrate/replication.ts +151 -0
  864. package/src/postgres/migrate/steps.ts +657 -0
  865. package/src/postgres/overlays/columns.ts +34 -0
  866. package/src/postgres/overlays/constraints.ts +56 -0
  867. package/src/postgres/overlays/indexes.ts +27 -0
  868. package/src/postgres/overlays/kinds.ts +53 -0
  869. package/src/postgres/overlays/partitioning.ts +26 -0
  870. package/src/postgres/overlays/relations.ts +29 -0
  871. package/src/postgres/overlays/storage.ts +75 -0
  872. package/src/postgres/overlays/type-ddl.ts +38 -0
  873. package/src/postgres/overlays/types.ts +56 -0
  874. package/src/postgres/parser.test.ts +214 -0
  875. package/src/postgres/parser.ts +1062 -0
  876. package/src/postgres/plan/commands.ts +124 -0
  877. package/src/postgres/plan/deep.ts +177 -0
  878. package/src/postgres/plan/diff.ts +323 -0
  879. package/src/postgres/plan/disruption.ts +52 -0
  880. package/src/postgres/plan/normalize.test.ts +148 -0
  881. package/src/postgres/plan/normalize.ts +542 -0
  882. package/src/postgres/plan/plan.e2e.test.ts +117 -0
  883. package/src/postgres/plan/plan.test.ts +244 -0
  884. package/src/postgres/plan/report.ts +24 -0
  885. package/src/postgres/plan/rules.ts +276 -0
  886. package/src/postgres/plan/schema.ts +114 -0
  887. package/src/postgres/plan/server-normalize.ts +123 -0
  888. package/src/postgres/providers/aurora.ts +45 -0
  889. package/src/postgres/providers/azure.ts +54 -0
  890. package/src/postgres/providers/cloud-sql.ts +42 -0
  891. package/src/postgres/providers/index.ts +90 -0
  892. package/src/postgres/providers/neon.ts +45 -0
  893. package/src/postgres/providers/providers.test.ts +136 -0
  894. package/src/postgres/providers/rds.ts +48 -0
  895. package/src/postgres/providers/supabase.ts +46 -0
  896. package/src/postgres/providers/types.ts +70 -0
  897. package/src/postgres/testdata/NOTICE +31 -0
  898. package/src/postgres/testdata/postgres-regress-corpus.json +460 -0
  899. package/src/postgres/testing/fake-client.ts +42 -0
  900. package/src/postgres/testing/migration.ts +52 -0
  901. package/src/postgres/testing/roundtrip-schema.ts +46 -0
  902. package/src/postgres/testing/server.ts +58 -0
  903. package/src/postgres/testing/writable-server.ts +188 -0
  904. package/src/postgres/tokens.ts +46 -0
  905. package/src/postgres.ts +75 -0
  906. package/src/serializer.test.ts +128 -0
  907. package/src/serializer.ts +148 -0
  908. package/src/skill-defs.test.ts +81 -0
  909. package/src/skill-defs.ts +102 -0
  910. package/src/skills/chant-sql-plan.md +123 -0
  911. package/src/skills/chant-sql-postgres-migration.md +126 -0
  912. package/src/skills/chant-sql-postgres-plan.md +194 -0
  913. package/src/skills/chant-sql-postgres.md +165 -0
  914. package/src/skills/chant-sql-rebuild.md +68 -0
  915. package/src/skills/chant-sql.md +123 -0
  916. package/src/spec/catalog.e2e.test.ts +29 -0
  917. package/src/spec/catalog.test.ts +56 -0
  918. package/src/spec/catalog.ts +311 -0
  919. package/src/spec/clickhouse-catalog.snapshot.json +5246 -0
  920. package/src/spec/fetch.test.ts +77 -0
  921. package/src/spec/fetch.ts +112 -0
  922. package/src/spec/pin.ts +47 -0
  923. package/src/spec/postgres-catalog-14.snapshot.json +3494 -0
  924. package/src/spec/postgres-catalog-15.snapshot.json +3529 -0
  925. package/src/spec/postgres-catalog-16.snapshot.json +3597 -0
  926. package/src/spec/postgres-catalog-17.snapshot.json +3656 -0
  927. package/src/spec/postgres-catalog-18.snapshot.json +3747 -0
  928. package/src/spec/postgres-catalog.test.ts +43 -0
  929. package/src/spec/postgres-catalog.ts +301 -0
  930. package/src/spec/postgres-fetch.test.ts +75 -0
  931. package/src/spec/postgres-fetch.ts +112 -0
  932. package/src/spec/postgres-pin.test.ts +64 -0
  933. package/src/spec/postgres-pin.ts +101 -0
  934. package/src/typecheck.test.ts +104 -0
  935. package/src/validate-cli.ts +6 -0
  936. package/src/validate.ts +149 -0
@@ -0,0 +1,460 @@
1
+ {
2
+ "source": "postgres/postgres REL_18_6 src/test/regress/sql",
3
+ "accepted": {
4
+ "comment": [
5
+ "COMMENT ON TABLE attmp_wrong IS 'table comment'",
6
+ "comment on column atacc1.a is 'testing'",
7
+ "comment on index at_partitioned_id_name_key is 'parent index'",
8
+ "comment on constraint at_partitioned_1_id_name_key on at_partitioned_1 is 'child 1 constraint'",
9
+ "COMMENT ON INDEX comment_test_index IS 'Simple index on comment_test'",
10
+ "COMMENT ON CONSTRAINT id_notnull_constraint ON comment_test IS 'NOT NULL constraint of comment_test'",
11
+ "COMMENT ON INDEX comment_test_child_fk IS 'Index backing the FOREIGN KEY of comment_test_child'",
12
+ "COMMENT ON CONSTRAINT constr_parent2_a_not_null ON constr_child2 IS 'this constraint is valid'",
13
+ "COMMENT ON CONSTRAINT no_constraint ON constraint_comments_tbl IS 'yes, the comment'",
14
+ "COMMENT ON CONSTRAINT the_constraint ON DOMAIN no_comments_dom IS 'another bad comment'",
15
+ "COMMENT ON CONSTRAINT the_constraint ON constraint_comments_tbl IS 'no, the comment'",
16
+ "COMMENT ON INDEX six_wrong IS 'bad index'",
17
+ "COMMENT ON INDEX six IS 'add the comment back'",
18
+ "COMMENT ON TABLE parted_col_comment IS 'Am partitioned table'",
19
+ "COMMENT ON COLUMN ctlt1.b IS 'B'",
20
+ "COMMENT ON INDEX ctlt1_b_key IS 'index b_key'",
21
+ "COMMENT ON COLUMN ctlt3.a IS 'A3'",
22
+ "COMMENT ON CONSTRAINT noinh_con_copy_b_not_null ON noinh_con_copy IS 'not null b'",
23
+ "COMMENT ON TYPE bad IS 'bad comment'",
24
+ "COMMENT ON COLUMN default_test_row.nope IS 'bad comment'",
25
+ "COMMENT ON VIEW noview IS 'no view'",
26
+ "comment on domain domaindroptest is 'About to drop this..'",
27
+ "COMMENT ON COLUMN ft1.c1 IS 'ft1.c1'",
28
+ "COMMENT ON CONSTRAINT constrname_wrong ON FKTABLE IS 'fk constraint comment'",
29
+ "COMMENT ON SEQUENCE asdf IS 'won''t work'"
30
+ ],
31
+ "domain": [
32
+ "create domain mytype as text",
33
+ "CREATE DOMAIN arrdomain AS int[]",
34
+ "CREATE DOMAIN testdomain_i AS int COLLATE \"sv_SE\"",
35
+ "CREATE DOMAIN constraint_comments_dom AS int CONSTRAINT the_constraint CHECK (value > 0)",
36
+ "create domain intdom1 as int",
37
+ "create domain d_fail as no_such_type",
38
+ "create domain d_fail int4 collate \"C\"",
39
+ "create domain domainint4 int4",
40
+ "create domain domainint4arr int4[1]",
41
+ "create domain dcomptype as comptype",
42
+ "create domain dposinta as posint[]",
43
+ "create domain dcheck varchar(15) NOT NULL CHECK (VALUE = 'a' OR VALUE = 'c' OR VALUE = 'd')",
44
+ "create domain ddef4 int4 DEFAULT nextval('ddef4_seq')",
45
+ "create domain connotnull integer",
46
+ "create domain dinter vchar4 check (substring(VALUE, 1, 1) = 'x')",
47
+ "create domain str_domain2 as text check (value <> 'foo') default 'foo'",
48
+ "create domain ddtest1d as ddtest1[]",
49
+ "create domain orderedpair as int[2] check (value[1] < value[2])",
50
+ "create domain testdomain1 as int constraint unsigned check (value > 0)",
51
+ "CREATE domain test_domain_exists as int not null check (value > 0)",
52
+ "CREATE DOMAIN domain3 AS text DEFAULT foo(4)",
53
+ "CREATE DOMAIN gtestdomain1 AS int CHECK (VALUE < 10)",
54
+ "create domain insert_nnarray as int[]\n check (value[1] is not null and value[2] is not null)",
55
+ "CREATE DOMAIN js_int_array_2d AS int[][] CHECK(array_length(VALUE, 2) = 3)",
56
+ "CREATE DOMAIN jsb_int_array_2d AS int[][] CHECK(array_length(VALUE, 2) = 3)",
57
+ "create domain mydomain as int4",
58
+ "create domain plpgsql_domain as integer check(plpgsql_domain_check(value))",
59
+ "CREATE DOMAIN priv_testdomain3a AS int",
60
+ "CREATE DOMAIN priv_testdomain3b AS int",
61
+ "CREATE DOMAIN testns.priv_testdomain1 AS int"
62
+ ],
63
+ "enum": [
64
+ "create type lockmodes as enum (\n 'SIReadLock'\n,'AccessShareLock'\n,'RowShareLock'\n,'RowExclusiveLock'\n,'ShareUpdateExclusiveLock'\n,'ShareLock'\n,'ShareRowExclusiveLock'\n,'ExclusiveLock'\n,'AccessExclusiveLock'\n)",
65
+ "create type _comptype as enum('fooey')",
66
+ "CREATE TYPE casetestenum AS ENUM ('e', 'f', 'g')",
67
+ "CREATE TYPE type_op3 AS ENUM ('new', 'open', 'closed')",
68
+ "CREATE TYPE type_op4 AS ENUM ('new', 'open', 'closed')",
69
+ "CREATE TYPE type_op5 AS ENUM ('new', 'open', 'closed')",
70
+ "CREATE TYPE type_op6 AS ENUM ('new', 'open', 'closed')",
71
+ "CREATE TYPE deptest_enum AS ENUM ('red')",
72
+ "CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple')",
73
+ "CREATE TYPE planets AS ENUM ( 'venus', 'earth', 'mars' )",
74
+ "create type insenum as enum ('L1', 'L2')",
75
+ "CREATE TYPE bogus AS ENUM('good', 'bad', 'ugly')",
76
+ "CREATE TYPE bogus AS ENUM('good')",
77
+ "CREATE TYPE bogus AS ENUM('good','bad','ugly')",
78
+ "CREATE TYPE bogus AS ENUM('good')",
79
+ "CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy')",
80
+ "CREATE TYPE addr_nsp.genenum AS ENUM ('one', 'two')",
81
+ "create type pp_colors as enum ('green', 'blue', 'black')",
82
+ "CREATE TYPE rf_bug_status AS ENUM ('new', 'open', 'closed')",
83
+ "CREATE TYPE mood AS ENUM ('happy', 'sad', 'neutral')",
84
+ "CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple')",
85
+ "create type stoplight as enum ('red', 'yellow', 'green')",
86
+ "CREATE TYPE tt_enum_type AS ENUM ('a')"
87
+ ],
88
+ "index": [
89
+ "create index minmaxtesti on minmaxtest(f1)",
90
+ "CREATE INDEX alter_idx_rename_test_idx ON alter_idx_rename_test (a)",
91
+ "CREATE INDEX old_system_table__othercol ON old_system_table (othercol)",
92
+ "CREATE INDEX brinidx_2 ON brintest_2 USING brin (n)",
93
+ "CREATE INDEX brin_summarize_bloom_idx ON brin_summarize_bloom USING brin (value) WITH (pages_per_range=2)",
94
+ "CREATE INDEX brin_test_multi_1_idx_1 ON brin_test_multi_1 USING brin (a int4_minmax_multi_ops) WITH (pages_per_range=5)",
95
+ "CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops)",
96
+ "CREATE INDEX clstr_tst_b_c ON clstr_tst (b,c)",
97
+ "CREATE INDEX collate_test1_idx6 ON collate_test1 ((a COLLATE \"POSIX\"))",
98
+ "CREATE INDEX IF NOT EXISTS onek_unique1 ON onek USING btree(unique1 int4_ops)",
99
+ "CREATE INDEX iix ON ihighway USING btree (name text_ops)",
100
+ "CREATE INDEX array_gin_test_idx ON array_gin_test USING gin (a)",
101
+ "CREATE UNIQUE INDEX covering_index_index on covering_index_heap (f1,f2) INCLUDE(f3)",
102
+ "CREATE INDEX std_index on concur_heap(f2)",
103
+ "CREATE INDEX ON syscol_table (a) WHERE ctid >= '(1000,0)'",
104
+ "CREATE INDEX concur_clustered_i_idx ON concur_clustered(i)",
105
+ "CREATE UNIQUE INDEX concur_exprs_index_pred_2\n ON concur_exprs_tab ((1 / c1))\n WHERE ('-H') >= (c2::TEXT) COLLATE \"C\"",
106
+ "CREATE INDEX sp_radix_ind ON radix_text_tbl USING spgist (t)",
107
+ "CREATE INDEX test_index_exists on test_exists(a)",
108
+ "CREATE INDEX id_ft1_c2 ON ft1 (c2)",
109
+ "CREATE INDEX gtest31_2_y_idx ON gtest31_2(((y).b))",
110
+ "create index gist_pointidx5 on gist_point_tbl using gist(p) with (fillfactor=101)",
111
+ "CREATE INDEX hash_i4_partial_index ON hash_i4_heap USING hash (seqno)\n WHERE seqno = 9999",
112
+ "CREATE INDEX tbl_include_reg_idx ON tbl_include_reg (c1, c2) INCLUDE (c3, c4)",
113
+ "CREATE INDEX on tbl USING gin(c1, c2) INCLUDE (c3, c4)",
114
+ "create index idxpart_idx on idxpart (a)",
115
+ "create index on idxpart (a)",
116
+ "create index on idxpart1 (a, a)",
117
+ "create index on idxpart11 (a)",
118
+ "create index on idxpart(c)",
119
+ "create index idxpart1_1b_idx on idxpart1 (b)",
120
+ "create index on idxpart2 (a) where b > 1000",
121
+ "create index on idxpart22 (a)",
122
+ "create index concurrently parted_isvalid_idx_11 on parted_isvalid_tab_11 ((a/b))",
123
+ "create index matest0i on matest0 ((1-id))",
124
+ "create index on bool_lp (b)",
125
+ "create unique index expr_part_comp_key_index on insertconflicttest(key, lower(fruit)) where key < 5",
126
+ "create unique index on only parted_conflict_1 (a)",
127
+ "CREATE INDEX tbl_phv_idx ON tbl_phv(x)",
128
+ "CREATE INDEX jidx_array ON testjsonb USING gin((j->'array'))",
129
+ "CREATE INDEX mvtest_aa ON mvtest_bb (grandtot)",
130
+ "CREATE INDEX strtest_t_idx ON strtest (t)",
131
+ "CREATE UNIQUE INDEX num_exp_sqrt_idx ON num_exp_sqrt (id)",
132
+ "CREATE INDEX ptif_test_index ON ONLY ptif_test (a)",
133
+ "CREATE INDEX iprt2_p3_b on prt2_p3(b)",
134
+ "create index ab_a2_b1_a_idx on ab_a2_b1 (a)",
135
+ "create index tprt4_idx on tprt_4 (col1)",
136
+ "create unique index Hub_name on Hub using btree (name bpchar_ops)",
137
+ "CREATE INDEX sro_idx ON sro_tab ((sro_ifun(a) + sro_ifun(0)))\n\tWHERE sro_ifun(a + 10) > sro_ifun(10)",
138
+ "CREATE UNIQUE INDEX idx_abcd_pk_c ON rf_tbl_abcd_pk(c)",
139
+ "create index test_range_spgist_idx on test_range_spgist using spgist (ir)",
140
+ "CREATE UNIQUE INDEX test_replica_identity_nonkey ON test_replica_identity (keya, nonkey)",
141
+ "CREATE INDEX distinct_tbl_x_y_idx ON distinct_tbl (x, y)",
142
+ "CREATE INDEX ON test_jsonb_mutability (JSON_QUERY(js, '$.a[0]'))",
143
+ "CREATE INDEX ON test_jsonb_mutability (JSON_QUERY(js, '$.a ? (@.time() < $.datetime(\"HH:MI TZH\"))'))",
144
+ "CREATE INDEX ON test_jsonb_mutability (JSON_QUERY(js, '$.a ? (@.datetime() < $.datetime(\"HH:MI TZH\"))'))",
145
+ "CREATE INDEX ON test_jsonb_mutability (JSON_QUERY(js, '$[1, $.a ? (@.datetime(\"HH:MI\") == $x)]' PASSING '12:34'::time AS x))",
146
+ "CREATE INDEX part_parent_i ON stats_import.part_parent(i)",
147
+ "CREATE INDEX test_index2 on testschema.test_default_tab (id) TABLESPACE regress_tblspace",
148
+ "create index wowidx on test_tsvector using gist (a)"
149
+ ],
150
+ "matview": [
151
+ "CREATE MATERIALIZED VIEW compressmv(x) AS SELECT * FROM cmdata1",
152
+ "CREATE MATERIALIZED VIEW concur_reindex_matview AS SELECT * FROM concur_reindex_tab",
153
+ "CREATE MATERIALIZED VIEW heapmv USING heap AS SELECT 1 AS a",
154
+ "CREATE MATERIALIZED VIEW mvtest_tvm AS SELECT * FROM mvtest_tv ORDER BY type",
155
+ "CREATE MATERIALIZED VIEW mvtest_tvmm AS SELECT sum(totamt) AS grandtot FROM mvtest_tvm",
156
+ "CREATE MATERIALIZED VIEW mvtest_bb AS SELECT * FROM mvtest_tvvmv",
157
+ "CREATE MATERIALIZED VIEW mv_test3 AS SELECT * FROM mv_test2 WHERE moo = 12345",
158
+ "CREATE MATERIALIZED VIEW mvtest_mv AS SELECT * FROM mvtest_foo",
159
+ "CREATE MATERIALIZED VIEW mvtest_mv2 AS SELECT * FROM mvtest_mv1\n WHERE col1 = (SELECT LEAST(col1) FROM mvtest_mv1) WITH NO DATA",
160
+ "CREATE MATERIALIZED VIEW mvtest_mv_v (ii, jj, kk) AS SELECT i, j FROM mvtest_v",
161
+ "CREATE MATERIALIZED VIEW mvtest_mv_v_2 (ii) AS SELECT i, j FROM mvtest_v",
162
+ "CREATE MATERIALIZED VIEW mvtest_mv_v_3 (ii, jj) AS SELECT i, j FROM mvtest_v WITH NO DATA",
163
+ "CREATE MATERIALIZED VIEW mv_unspecified_types AS\n SELECT 42 as i, 42.5 as num, 'foo' as u, 'foo'::unknown as u2, null as n",
164
+ "create materialized view mvtest_error as select 1/0 as x with no data",
165
+ "CREATE MATERIALIZED VIEW mvtest_mv_foo AS SELECT * FROM mvtest_foo_data",
166
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS mvtest_mv_foo AS SELECT * FROM mvtest_foo_data",
167
+ "CREATE MATERIALIZED VIEW matview_schema.mv_withdata1 (a) AS\n SELECT generate_series(1, 10) WITH DATA",
168
+ "CREATE MATERIALIZED VIEW matview_ine_tab AS SELECT 1",
169
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS matview_ine_tab AS\n SELECT 1 / 0",
170
+ "CREATE MATERIALIZED VIEW IF NOT EXISTS matview_ine_tab AS\n SELECT 1 / 0 WITH NO DATA",
171
+ "CREATE MATERIALIZED VIEW test_maint_mv AS SELECT fn(i) FROM test_maint",
172
+ "CREATE MATERIALIZED VIEW ptif_test_matview AS SELECT 1",
173
+ "CREATE MATERIALIZED VIEW sro_index_mv AS SELECT 1 AS c",
174
+ "CREATE MATERIALIZED VIEW mat_view_heap_psql USING heap_psql AS SELECT f1 from tbl_heap_psql",
175
+ "CREATE MATERIALIZED VIEW testschema.amv AS SELECT * FROM testschema.atable"
176
+ ],
177
+ "schema": [
178
+ "CREATE SCHEMA alt_nsp1",
179
+ "create schema alter1",
180
+ "create schema alter1",
181
+ "CREATE SCHEMA collate_tests",
182
+ "CREATE SCHEMA temp_func_test",
183
+ "CREATE SCHEMA regress_tenant_schema AUTHORIZATION regress_tenant",
184
+ "CREATE SCHEMA testviewschm2",
185
+ "CREATE SCHEMA schema_one authorization regress_evt_user",
186
+ "CREATE SCHEMA concur_reindex_schema",
187
+ "CREATE SCHEMA fkpart3",
188
+ "CREATE SCHEMA fkpart9",
189
+ "CREATE SCHEMA generated_stored_tests",
190
+ "create schema regress_indexing",
191
+ "CREATE SCHEMA matview_schema",
192
+ "CREATE SCHEMA IF NOT EXISTS test_ns_schema_renamed",
193
+ "CREATE SCHEMA testns",
194
+ "CREATE SCHEMA testns4",
195
+ "CREATE SCHEMA testns",
196
+ "CREATE SCHEMA tableam_display",
197
+ "CREATE SCHEMA testpub_rf_schema1"
198
+ ],
199
+ "sequence": [
200
+ "CREATE SEQUENCE DEFAULT_SEQ",
201
+ "CREATE SEQUENCE INSERT_SEQ",
202
+ "CREATE SEQUENCE ctlseq1",
203
+ "CREATE TEMPORARY SEQUENCE seq1_temp",
204
+ "create sequence ddef4_seq",
205
+ "create temp sequence testseq",
206
+ "create temp sequence seq",
207
+ "CREATE TEMPORARY SEQUENCE rngfunc_rescan_seq1",
208
+ "create sequence rtest_seq",
209
+ "CREATE SEQUENCE sequence_testx INCREMENT BY -1 MINVALUE 20",
210
+ "CREATE SEQUENCE sequence_testx INCREMENT BY -1 START 10",
211
+ "CREATE SEQUENCE sequence_testx CACHE 0",
212
+ "CREATE SEQUENCE sequence_testx OWNED BY pg_class_oid_index.oid",
213
+ "CREATE SEQUENCE sequence_testx OWNED BY sequence_test_table.b",
214
+ "CREATE SEQUENCE sequence_test6 AS smallint",
215
+ "CREATE SEQUENCE sequence_test8 AS integer MAXVALUE 100000",
216
+ "CREATE SEQUENCE sequence_test10 AS integer MINVALUE -100000 START 1",
217
+ "CREATE SEQUENCE sequence_test12 AS smallint INCREMENT -1",
218
+ "CREATE SEQUENCE sequence_test14 AS smallint MAXVALUE 32767 INCREMENT -1",
219
+ "CREATE SEQUENCE sequence_testx AS nosuchtype",
220
+ "CREATE SEQUENCE sequence_testx AS smallint MINVALUE -100000",
221
+ "CREATE SEQUENCE IF NOT EXISTS sequence_test",
222
+ "CREATE TEMP SEQUENCE myseq2",
223
+ "CREATE SEQUENCE sequence_test2 START WITH 32",
224
+ "CREATE SEQUENCE sequence_test3"
225
+ ],
226
+ "table": [
227
+ "CREATE TABLE aggtest (\n\ta \t\t\tint2,\n\tb\t\t\tfloat4\n)",
228
+ "CREATE TABLE attmp (regtable int)",
229
+ "CREATE TEMP TABLE FKTABLE (ftest1 inet)",
230
+ "create table atacc1 ( test int )",
231
+ "create table parent (a float8, b numeric(10,4), c text collate \"C\")",
232
+ "create table depth1(c text) inherits (depth0)",
233
+ "CREATE TABLE test_type_diff (f1 int)",
234
+ "CREATE TABLE tt7 (x int, q text, y numeric(8,2))",
235
+ "CREATE TABLE fail_part (LIKE list_parted)",
236
+ "CREATE TABLE partr_def1 PARTITION OF range_parted DEFAULT",
237
+ "CREATE TABLE not_a_part (a int)",
238
+ "create table perm_part_child (a int)",
239
+ "create temp table arr_tbl (f1 int[] unique)",
240
+ "CREATE TABLE brin_test (a INT, b INT)",
241
+ "CREATE TABLE bt_f8_heap (\n\tseqno \t\tfloat8,\n\trandom \t\tint4\n)",
242
+ "CREATE TABLE clstrpart33 PARTITION OF clstrpart3 DEFAULT",
243
+ "CREATE TABLE collate_test2 (\n a int,\n b text COLLATE \"POSIX\"\n)",
244
+ "CREATE TABLE cmdata2 (f1 int)",
245
+ "CREATE TABLE COPY_TBL (x INT, y TEXT, z INT,\n\tCONSTRAINT COPY_CON\n\tCHECK (x > 3 AND y <> 'check failed' AND x < 7 ))",
246
+ "create table notnull_tbl2 (a serial, constraint foo not null a)",
247
+ "CREATE TABLE ATACC1 (a int NOT NULL NO INHERIT) PARTITION BY LIST (a)",
248
+ "CREATE TABLE notnull_tbl4_cld3 (PRIMARY KEY (a) DEFERRABLE, CONSTRAINT a_nn NOT NULL a) INHERITS (notnull_tbl4)",
249
+ "CREATE TABLE pp_nn_1 PARTITION OF pp_nn FOR VALUES WITH (MODULUS 2, REMAINDER 0)",
250
+ "create temp table copytest2 (like copytest)",
251
+ "create table copydml_test (id serial, t text)",
252
+ "CREATE TABLE cwi_test(a int, b int)",
253
+ "CREATE TABLE c_star (\n\tc \t\t\tname\n) INHERITS (a_star)",
254
+ "CREATE TABLE default_expr_non_column (a int DEFAULT (avg(non_existent)))",
255
+ "CREATE TABLE partitioned2 (\n\ta int,\n\tb text\n) PARTITION BY RANGE ((a+1), substr(b, 1, 5))",
256
+ "CREATE TABLE fail_part PARTITION OF list_parted FOR VALUES WITH (MODULUS 10, REMAINDER 1)",
257
+ "CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES WITH (MODULUS 10, REMAINDER 1)",
258
+ "CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (1) TO (1)",
259
+ "CREATE TABLE h2part_3 PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 8, REMAINDER 4)",
260
+ "CREATE TABLE unbounded_range_part PARTITION OF range_parted4 FOR VALUES FROM (MINVALUE, MINVALUE, MINVALUE) TO (MAXVALUE, MAXVALUE, MAXVALUE)",
261
+ "create table part_column_drop (\n useless_1 int,\n id int,\n useless_2 int,\n d int,\n b int,\n useless_3 int\n) partition by range (id)",
262
+ "CREATE TABLE test_like_6c (LIKE test_like_6 INCLUDING ALL)",
263
+ "CREATE TABLE ctlt11a (LIKE ctlv1 INCLUDING ALL)",
264
+ "create table tbl1a (a int, c int)",
265
+ "create table domarrtest\n ( testint4arr domainint4arr\n , testchar4arr domainchar4arr\n )",
266
+ "CREATE TABLE regress_encoding(good text, truncated text, with_nul text, truncated_with_nul text)",
267
+ "CREATE TABLE evttrig.part_1_10 PARTITION OF evttrig.parted (id)\n FOR VALUES FROM (1) TO (10)",
268
+ "CREATE TABLE T(pk INT NOT NULL PRIMARY KEY, c_int INT DEFAULT 1)",
269
+ "CREATE TABLE lt1_part1\n PARTITION OF lt1 FOR VALUES FROM (0) TO (1000)\n PARTITION BY RANGE (a)",
270
+ "CREATE TABLE PKTABLE (tid int, id int, PRIMARY KEY (tid, id))",
271
+ "CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3,\nptest4) REFERENCES pktable(ptest1, ptest2))",
272
+ "CREATE TABLE fktable (\n\tid\t\tINT4 PRIMARY KEY,\n\tfk\t\tINT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED\n)",
273
+ "create table pktable2(f1 int primary key)",
274
+ "CREATE TABLE fk_notpartitioned_pk (a int, b int, primary key (a, b))",
275
+ "create table other_partitioned_fk(a int, b int) partition by list (a)",
276
+ "CREATE TABLE droppk (a int PRIMARY KEY) PARTITION BY RANGE (a)",
277
+ "CREATE TABLE ref(f1 int, f2 int, f3 int)\n PARTITION BY list(f1)",
278
+ "CREATE TABLE fk_d PARTITION OF fk DEFAULT",
279
+ "CREATE TEMP TABLE articles_in_category (\n article_id int,\n category_id int,\n changed date,\n PRIMARY KEY (article_id, category_id)\n)",
280
+ "CREATE TABLE gtest_normal_child (a int, b int GENERATED ALWAYS AS (a * 2) STORED) INHERITS (gtest_normal)",
281
+ "CREATE TABLE gtest11 (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (b * 2) STORED)",
282
+ "CREATE TABLE gtest_child2 PARTITION OF gtest_parent (\n f3 WITH OPTIONS GENERATED ALWAYS AS (f2 * 22) STORED -- overrides gen expr\n) FOR VALUES FROM ('2016-08-01') TO ('2016-09-01')",
283
+ "CREATE TABLE gtest31_2 (x int, y gtest31_1)",
284
+ "CREATE TABLE gtestm (\n a int PRIMARY KEY,\n b int GENERATED ALWAYS AS (a * 2) VIRTUAL\n)",
285
+ "CREATE TABLE gtest_tableoid (\n a int PRIMARY KEY,\n b bool GENERATED ALWAYS AS (tableoid = 'gtest_tableoid'::regclass) VIRTUAL\n)",
286
+ "CREATE TABLE gtest23q (a int PRIMARY KEY, b int REFERENCES gtest23p (y))",
287
+ "CREATE TABLE gtest_part_key (f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) VIRTUAL) PARTITION BY RANGE ((gtest_part_key is not null))",
288
+ "create table gist_point_tbl(id int4, p point)",
289
+ "CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone)",
290
+ "CREATE TABLE itest12 OF itest_type (f1 WITH OPTIONS GENERATED ALWAYS AS IDENTITY)",
291
+ "CREATE TABLE tbl_include_unique1 (c1 int, c2 int, c3 int, c4 box)",
292
+ "/*\n * 6. EXCLUDE constraint.\n */\nCREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box, EXCLUDE USING gist (c4 WITH &&) INCLUDE (c1, c2, c3))",
293
+ "create table idxpart21 partition of idxpart2 for values from (100) to (200)",
294
+ "create table idxpart1 (like idxpart)",
295
+ "create table idxpart(drop_1 int, drop_2 int, col_keep int, drop_3 int) partition by range (col_keep)",
296
+ "create table idxpart (a int4range, b int4range) partition by range (a)",
297
+ "create table idxpart11 (a int not null, b int primary key)",
298
+ "create table pk2 (b int, a int)",
299
+ "create table parted_isvalid_tab_11 partition of parted_isvalid_tab_1\n for values from (1) to (5)",
300
+ "create table parted_tab (a int, b char) partition by list (a)",
301
+ "create table p2(f1 text)",
302
+ "CREATE TABLE inht4 (z int) INHERITS (inht2, inht3)",
303
+ "create table p1p2_c1 (f1 int) inherits (p1, p2)",
304
+ "create table inhcld2(f1 int primary key, f2 name)",
305
+ "create table inh_nn_parent(a int)",
306
+ "create table inh_child1() inherits(inh_parent)",
307
+ "create table inh_child () inherits (inh_parent)",
308
+ "create table mcrparted0 partition of mcrparted for values from (minvalue, minvalue, minvalue) to (1, 1, 1)",
309
+ "create table bool_rp_true_2k partition of bool_rp for values from (true,1000) to (true,2000)",
310
+ "create table part2 partition of range_parted for values from ('a', 10) to ('a', 20)",
311
+ "create table hash_parted (\n\ta int\n) partition by hash (a part_test_int4_ops)",
312
+ "create table mlparted5_b (d int, b int, c text, a int)",
313
+ "create table mcrparted7_gt_common_lt_d partition of mcrparted for values from ('common', maxvalue) to ('d', minvalue)",
314
+ "create table parted_conflict_1_1 partition of parted_conflict_1 for values from (0) to (500)",
315
+ "create temp table tt5(f1 int, f2 int)",
316
+ "create temp table parent (k int primary key, pd int)",
317
+ "create table join_pt1p1 partition of join_pt1 for values from (0) to (100) partition by range(b)",
318
+ "CREATE TEMP TABLE foo (serial_num int, name text, type text)",
319
+ "CREATE TABLE target (tid integer, balance integer)\n WITH (autovacuum_enabled=off)",
320
+ "CREATE TABLE pa_target (logts timestamp, tid integer, balance float, val text)\n\tPARTITION BY RANGE (logts)",
321
+ "CREATE TABLE hobbies_r (\n\tname\t\ttext,\n\tperson \t\ttext\n)",
322
+ "CREATE TABLE ceil_floor_round (a numeric)",
323
+ "CREATE TABLE pagg_tab2(x int, y int) PARTITION BY RANGE(y)",
324
+ "CREATE TABLE ptif_test3 PARTITION OF ptif_test\n FOR VALUES FROM (200) TO (maxvalue) PARTITION BY list (b)",
325
+ "CREATE TABLE prt2_m_p2 PARTITION OF prt2_m FOR VALUES FROM (250, 250) TO (500, 500)",
326
+ "CREATE TABLE prt1_l (a int, b int, c varchar) PARTITION BY RANGE(a)",
327
+ "CREATE TABLE prt4_n (a int, b int, c text) PARTITION BY RANGE(a)",
328
+ "CREATE TABLE prt1_adv (a int, b int, c varchar) PARTITION BY RANGE (a)",
329
+ "CREATE TABLE plt3_adv_p1 PARTITION OF plt3_adv FOR VALUES IN ('0004', '0006')",
330
+ "CREATE TABLE alpha_neg PARTITION OF alpha FOR VALUES FROM ('-Infinity') TO (0) PARTITION BY RANGE (b)",
331
+ "create table lp_null partition of lp for values in (null)",
332
+ "create table rangepart1 partition of rangepart for values from (0) to (10)",
333
+ "create table iboolpart (a bool) partition by list ((not a))",
334
+ "create table coll_pruning_multi2 partition of coll_pruning_multi for values from ('a', 'e') to ('a', 'z')",
335
+ "create table ab_a1_b1 partition of ab_a1 for values in (1)",
336
+ "create table part_bac (b int not null, a int not null, c int not null) partition by list (b)",
337
+ "create table pp_arrpart2 partition of pp_arrpart for values in ('{2, 3}', '{4, 5}')",
338
+ "create temp table q1 partition of q for values in (1) partition by list (b)",
339
+ "create table rp_prefix_test3 (a int, b int, c int, d int) partition by range(a, b, c, d)",
340
+ "create table pc_list_part_null partition of pc_list_parted for values in (null)",
341
+ "CREATE TABLE transition_table_level1\n(\n level1_no serial NOT NULL ,\n level1_node_name varchar(255),\n PRIMARY KEY (level1_no)\n) WITHOUT OIDS",
342
+ "CREATE TABLE pxtest3(fff int)",
343
+ "CREATE TABLE test6b OF priv_testtype1",
344
+ "CREATE TABLE regress_roleoption.t3 (a int)",
345
+ "CREATE TABLE bla(s TEXT)",
346
+ "CREATE TABLE rf_tbl_abcd_part_pk_1 (b int, a int PRIMARY KEY)",
347
+ "CREATE TABLE pub_testpart1.parent1 (a int) partition by list (a)",
348
+ "create table test_range_spgist(ir int4range)",
349
+ "CREATE TABLE reloptions_test (s VARCHAR) WITH\n\t(toast.autovacuum_vacuum_cost_delay = 23,\n\tautovacuum_vacuum_cost_delay = 24, fillfactor = 40)",
350
+ "CREATE TABLE part_document_fiction PARTITION OF part_document FOR VALUES FROM (11) to (12)",
351
+ "CREATE TABLE current_check_2 (a int, b text)",
352
+ "create table test_t (c text)",
353
+ "create table rtest_t6 (a int4, b text)",
354
+ "CREATE TABLE ruletest_tbl (a int, b int)",
355
+ "CREATE TABLE rule_merge1 (a int, b text)",
356
+ "CREATE TABLE customer (\n cid int primary key,\n name text not null,\n tel text,\n passwd\ttext\n)",
357
+ "CREATE TEMPORARY TABLE test_io_local(a int, b TEXT)",
358
+ "CREATE TABLE mcv_lists_bool (\n a BOOL,\n b BOOL,\n c BOOL\n)\nWITH (autovacuum_enabled = off)",
359
+ "create temp table shipped (\n ttype char(2),\n ordnum int4,\n partnum text,\n value float8\n)",
360
+ "create table parted_sample_1 partition of parted_sample for values in (1)",
361
+ "CREATE TABLE testschema.dflt (a int PRIMARY KEY USING INDEX TABLESPACE regress_tblspace) PARTITION BY LIST (a)",
362
+ "create temp table temp_parted_oncommit_1\n partition of temp_parted_oncommit\n for values in (1) on commit delete rows",
363
+ "CREATE TABLE stud_emp (\n\tpercent \tint4\n) INHERITS (emp, student)",
364
+ "create table revalidate_bug (c float8 unique)",
365
+ "create table stmt_trig_on_empty_upd (a int)",
366
+ "create table parted_trig2 partition of parted_trig for values in (2)",
367
+ "create table unparted_trigger (a int, b text)",
368
+ "CREATE TABLE trgfire2 PARTITION OF trgfire FOR VALUES FROM (10) TO (20)",
369
+ "create table iocdu_tt_parted2 partition of iocdu_tt_parted for values in (2)",
370
+ "create table grandparent (id int, primary key (id)) partition by range (id)",
371
+ "CREATE TABLE truncpart_2_1 PARTITION OF truncpart_2 FOR VALUES FROM (100) TO (150)",
372
+ "CREATE TABLE persons2 OF person_type (\n id WITH OPTIONS PRIMARY KEY,\n UNIQUE (name)\n)",
373
+ "CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified', c serial)",
374
+ "CREATE TABLE tx2 (b integer)",
375
+ "CREATE TABLE upsert_test (\n a INT PRIMARY KEY,\n b TEXT\n) PARTITION BY LIST (a)",
376
+ "CREATE TABLE non_parted (id int)"
377
+ ],
378
+ "view": [
379
+ "create temp view v1 as\nselect f1::int from t1 left join t2 using (f1) group by f1",
380
+ "create view v_pagg_test AS\nselect\n\ty,\n\tmin(t) AS tmin,max(t) AS tmax,count(distinct t) AS tndistinct,\n\tmin(b) AS bmin,max(b) AS bmax,count(distinct b) AS bndistinct,\n\tmin(a) AS amin,max(a) AS amax,count(distinct a) AS andistinct,\n\tmin(aa) AS aamin,max(aa) AS aamax,count(distinct aa) AS aandistinct\nfrom (\n\tselect\n\t\ty,\n\t\tunnest(regexp_split_to_array(a1.t, ','))::int AS t,\n\t\tunnest(regexp_split_to_array(a1.b::text, ',')) AS b,\n\t\tunnest(a1.a) AS a,\n\t\tunnest(a1.aa) AS aa\n\tfrom (\n\t\tselect\n\t\t\ty,\n\t\t\tstring_agg(x::text, ',') AS t,\n\t\t\tstring_agg(x::text::bytea, ',') AS b,\n\t\t\tarray_agg(x) AS a,\n\t\t\tarray_agg(ARRAY[x]) AS aa\n\t\tfrom pagg_test\n\t\tgroup by y\n\t) a1\n) a2\ngroup by y",
381
+ "create or replace view at_view_1 as select *, 2+2 as more from at_base_table bt",
382
+ "CREATE VIEW collview2 AS SELECT a, b FROM collate_test1 ORDER BY b COLLATE \"C\"",
383
+ "CREATE VIEW tenant_view AS SELECT * FROM pg_catalog.pg_class",
384
+ "CREATE OR REPLACE VIEW viewtest AS\n\tSELECT * FROM viewtest_tbl WHERE a > 10",
385
+ "CREATE VIEW v1 AS SELECT * FROM base_table",
386
+ "CREATE VIEW v4 AS SELECT * FROM base_table WHERE id IN (SELECT id FROM base_table2)",
387
+ "CREATE VIEW v9_temp AS SELECT * FROM base_table WHERE NOT EXISTS (SELECT 1 FROM temp_table)",
388
+ "CREATE VIEW nontemp2 AS SELECT * FROM t1 INNER JOIN t2 ON t1.num = t2.num2",
389
+ "CREATE VIEW mysecview1\n AS SELECT * FROM tbl1 WHERE a = 0",
390
+ "CREATE VIEW mysecview9 WITH (security_invoker)\n AS SELECT * FROM tbl1 WHERE a < 100",
391
+ "CREATE OR REPLACE VIEW mysecview9 WITH (security_invoker=false, security_barrier=true)\n AS SELECT * FROM tbl1 WHERE a <> 256",
392
+ "create view view_of_joins as\nselect * from\n (select * from (tbl1 cross join tbl2) same) ss,\n (tbl3 cross join tbl4) same",
393
+ "create view v2a as select * from (tt2 join tt3 using (b,c) join tt4 using (b)) j",
394
+ "create view vv5 as select x,y,z from tt9 join tt10 using(x)",
395
+ "create view tt19v as\nselect 'foo'::text = any(array['abc','def','foo']::text[]) c1,\n 'foo'::text = any((select array['abc','def','foo']::text[])::text[]) c2",
396
+ "create view tt26v as\nselect x + y + z as c1,\n (x * y) + z as c2,\n x + (y * z) as c3,\n (x + y) * z as c4,\n x * (y + z) as c5,\n x + (y + z) as c6,\n x + (y # z) as c7,\n (x > y) AND (y > z OR x > z) as c8,\n (x > y) OR (y > z AND NOT (x > z)) as c9,\n (x,y) <> ALL (values(1,2),(3,4)) as c10,\n (x,y) <= ANY (values(1,2),(3,4)) as c11\nfrom (values(1,2,3)) v(x,y,z)",
397
+ "CREATE TEMP VIEW fdv1 AS\nSELECT id, keywords, title, body, created\nFROM articles\nGROUP BY id",
398
+ "CREATE VIEW itestv10 AS SELECT * FROM itest10",
399
+ "CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousand < 995\n\t\tORDER BY thousand FETCH FIRST (NULL+1) ROWS WITH TIES",
400
+ "CREATE VIEW lock_view6 AS SELECT * from (select * from lock_tbl1) sub",
401
+ "CREATE VIEW mvtest_vt2 AS SELECT moo, 2*moo FROM mvtest_vt1 UNION ALL SELECT moo, 3*moo FROM mvtest_vt1",
402
+ "CREATE OR REPLACE TEMP VIEW pcacheview AS\n SELECT q1, q2/2 AS q2 FROM pcachetest",
403
+ "CREATE VIEW atest12sbv WITH (security_barrier=true) AS\n SELECT * FROM atest12 WHERE b <<< 5",
404
+ "CREATE VIEW view_heap_psql AS SELECT f1 from tbl_heap_psql",
405
+ "CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc1(1) WITH ORDINALITY as t1(v,o)",
406
+ "CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc5(1) WITH ORDINALITY AS t1(a,b,c,o)",
407
+ "CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc9(1) WITH ORDINALITY AS t1(a,b,c,o)",
408
+ "CREATE VIEW rec2v AS SELECT * FROM rec2",
409
+ "CREATE VIEW rls_view WITH (security_invoker) AS\n SELECT * FROM z1 WHERE f_leak(b)",
410
+ "create view rtest_vview1 as select a, b from rtest_view1 X\n\twhere 0 < (select count(*) from rtest_view2 Y where Y.a = X.a)",
411
+ "CREATE VIEW shoe_ready AS\n\tSELECT rsh.shoename,\n\t\t rsh.sh_avail,\n\t\t rsl.sl_name,\n\t\t rsl.sl_avail,\n\t\t int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail\n\t FROM shoe rsh, shoelace rsl\n\t WHERE rsl.sl_color = rsh.slcolor\n\t AND rsl.sl_len_cm >= rsh.slminlen_cm\n\t AND rsl.sl_len_cm <= rsh.slmaxlen_cm",
412
+ "create view rule_v1 as values(1,2)",
413
+ "CREATE VIEW my_property_normal AS\n SELECT * FROM customer WHERE name = current_user",
414
+ "CREATE VIEW json_objectagg_view AS\nSELECT JSON_OBJECTAGG(i: ('111' || i)::bytea FORMAT JSON WITH UNIQUE RETURNING text) FILTER (WHERE i > 3)\nFROM generate_series(1,5) i",
415
+ "CREATE VIEW jsonb_table_view6 AS\nSELECT * FROM\n\tJSON_TABLE(\n\t\tjsonb 'null', 'lax $[*]' PASSING 1 + 2 AS a, json '\"foo\"' AS \"b c\"\n\t\tCOLUMNS (\n\t\t\tjs2 json PATH '$',\n\t\t\tjsb2w jsonb PATH '$' WITH WRAPPER,\n\t\t\tjsb2q jsonb PATH '$' OMIT QUOTES,\n\t\t\tia int[] PATH '$',\n\t\t\tta text[] PATH '$',\n\t\t\tjba jsonb[] PATH '$'))",
416
+ "CREATE VIEW tststats.priv_test_view WITH (security_barrier=true)\n AS SELECT * FROM tststats.priv_test_tbl WHERE false",
417
+ "CREATE VIEW test_tablesample_v2 AS\n SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (99)",
418
+ "CREATE VIEW city_view AS\n SELECT city_id, city_name, population, country_name, continent\n FROM city_table ci\n LEFT JOIN country_table co ON co.country_id = ci.country_id",
419
+ "CREATE VIEW ro_view6 AS SELECT a, b FROM base_tbl UNION SELECT -a, b FROM base_tbl",
420
+ "CREATE VIEW rw_view14 AS SELECT ctid, a, b FROM base_tbl",
421
+ "CREATE VIEW rw_view1 AS\n SELECT b AS bb, a AS aa, 'Const1' AS c FROM base_tbl WHERE a>0",
422
+ "CREATE VIEW rw_view2 AS SELECT b AS bb, c AS cc, a AS aa FROM base_tbl",
423
+ "CREATE VIEW rw_view1 AS SELECT * FROM base_tbl ORDER BY a+b",
424
+ "CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b\n WITH LOCAL CHECK OPTION",
425
+ "CREATE VIEW rw_view1 AS\n SELECT * FROM base_tbl b\n WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a)\n WITH CHECK OPTION",
426
+ "CREATE VIEW rw_view1 WITH (security_barrier=true) AS\n SELECT id, data FROM base_tbl WHERE NOT deleted",
427
+ "CREATE VIEW v2 WITH (security_barrier = true) AS\n SELECT * FROM v1 WHERE EXISTS (SELECT 1)",
428
+ "create view uv_iocu_view as\n select b as bb, a as aa, uv_iocu_tab::text as cc from uv_iocu_tab"
429
+ ]
430
+ },
431
+ "rejected": [
432
+ "CREATE TABLE test2bpci (x char(3) COLLATE case_insensitive);\nCREATE TABL",
433
+ "CREATE TABLE test12fk (",
434
+ "CREATE TABLE pagg_tab4_p1 PARTITION OF pagg_tab4 FOR VALUES IN ('a', 'b');\nCREATE TABLE pagg_tab4_p2 PARTITION OF pagg_tab4 ",
435
+ "CREATE DOMAIN testdomain_sv AS text COLLATE \"sv_SE\";\nC",
436
+ "CREATE TABLE collate_test5 (\n a int,\n b testdomain_sv COLLATE \"en_US\"\n);\nI",
437
+ "CREATE INDEX collate_test1_idx1 ON collate_test1 (b);\nCREATE INDEX ",
438
+ "CREATE TABLE error_tbl (i int DEFAULT (100, ))",
439
+ "CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2))",
440
+ "CREATE INDEX IF NOT EXISTS ON onek USING btree(unique1 int4_ops)",
441
+ "CREATE TABLE withoid() WITH OIDS",
442
+ "CREATE TABLE fail_part PARTITION OF list_parted FOR VALUES IN ()",
443
+ "CREATE TABLE toast_3b_utf8 (c text);\nI",
444
+ "CREATE TABLE ",
445
+ "CREATE TABLE\n\n\nINSERT INTO foo VALUES(123) foo",
446
+ "CREATE TABLE foo\n (id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY,\n\tid3 INTEGER NOT NUL,\n id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL)",
447
+ "CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,\nid4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL)",
448
+ "CREATE TABLE foo(\nid3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY)",
449
+ "CREATE TABLE foo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL)",
450
+ "CREATE\nTEMPORARY\nTABLE\nfoo(id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL,\nid4 INT4\nUNIQUE\nNOT\nNULL,\nid5 TEXT\nUNIQUE\nNOT\nNULL)\n",
451
+ "CREATE\nTEMPORARY\nTABLE\nfoo(\nid3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL, id INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY)\n",
452
+ "CREATE\nTEMPORARY\nTABLE\nfoo\n(id\nINT4\nUNIQUE NOT NULL, idx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL,\nidz INT4 UNIQUE NOT NULL,\nidv INT4 UNIQUE NOT NULL)",
453
+ "CREATE\nTEMPORARY\nTABLE\nfoo\n(id\nINT4\nUNIQUE\nNOT\nNULL\n,\nidm\nINT4\nUNIQUE\nNOT\nNULL,\nidx INT4 UNIQUE NOT NULL, idy INT4 UNIQUE NOT NULL, id2 TEXT NOT NULL PRIMARY KEY, id3 INTEGER NOT NUL, id4 INT4 UNIQUE NOT NULL, id5 TEXT UNIQUE NOT NULL,\nidz INT4 UNIQUE NOT NULL,\nidv\nINT4\nUNIQUE\nNOT\nNULL)",
454
+ "CREATE TABLE psql_comics(s TEXT) \\",
455
+ "CREATE TABLE foo(s TEXT) \\",
456
+ "CREATE TABLE foo(s TEXT) \\",
457
+ "create table foo (with baz)",
458
+ "create table foo (with ordinality)"
459
+ ]
460
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A fake Postgres client for unit tests: answers the catalog reader's queries
3
+ * (`../live/catalog.ts`) from rows the test gives, by which catalog each query
4
+ * reads. Anything else answers no rows.
5
+ */
6
+
7
+ import type { PostgresClient } from "../live/client";
8
+
9
+ export interface FakeCatalog {
10
+ schemas?: Array<{ name: string; comment?: string }>;
11
+ tables?: Array<{ schema: string; name: string; comment?: string; columns?: Array<{ name: string; type: string; notnull?: boolean; dflt?: string }> }>;
12
+ views?: Array<{ schema: string; name: string; def: string; materialized?: boolean; comment?: string }>;
13
+ indexes?: Array<{ schema: string; name: string; table: string; def: string }>;
14
+ }
15
+
16
+ export function fakeClient(catalog: FakeCatalog, log: string[] = []): PostgresClient {
17
+ let oid = 16384;
18
+ const tables = (catalog.tables ?? []).map((t) => ({ ...t, oid: String(oid++) }));
19
+ return {
20
+ async query<T>(sql: string): Promise<T[]> {
21
+ log.push(sql);
22
+ const rows = (r: unknown[]) => r as T[];
23
+ if (sql.includes("FROM pg_catalog.pg_namespace n WHERE")) return rows((catalog.schemas ?? []).map((s, i) => ({ oid: String(100 + i), name: s.name, comment: s.comment ?? null })));
24
+ if (sql.includes("c.relkind IN ('r', 'p')")) {
25
+ return rows(tables.map((t) => ({ oid: t.oid, schema: t.schema, name: t.name, kind: "r", persistence: "p", ispartition: false, typed: false, partkey: null, bound: null, parents: [], reloptions: null, am: "heap", tablespace: null, comment: t.comment ?? null })));
26
+ }
27
+ if (sql.includes("FROM pg_catalog.pg_attribute a JOIN")) {
28
+ return rows(
29
+ tables.flatMap((t) =>
30
+ (t.columns ?? []).map((c, i) => ({ rel: t.oid, num: i + 1, name: c.name, type: c.type, notnull: c.notnull ?? false, identity: "", generated: "", islocal: true, dflt: c.dflt ?? null, collation: null, comment: null, compression: "", storage: "x", typstorage: "x" })),
31
+ ),
32
+ );
33
+ }
34
+ if (sql.includes("c.relkind IN ('v', 'm')")) {
35
+ return rows((catalog.views ?? []).map((v) => ({ oid: String(oid++), schema: v.schema, name: v.name, kind: v.materialized ? "m" : "v", def: v.def, reloptions: null, populated: true, am: null, tablespace: null, comment: v.comment ?? null, column_comments: [] })));
36
+ }
37
+ if (sql.includes("FROM pg_catalog.pg_index i")) return rows((catalog.indexes ?? []).map((x) => ({ oid: String(oid++), schema: x.schema, name: x.name, table_name: x.table, def: x.def, comment: null })));
38
+ return [];
39
+ },
40
+ async end() {},
41
+ };
42
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Running `PostgresMigrationOp` in a live test (#3281, #3322): the Op's
3
+ * activities with the test's config and server, core's local executor, and
4
+ * an in-memory gate ledger a test approves on.
5
+ */
6
+
7
+ import { memoryGateLedgerPort, runOpLocally, loadProfiles, type ActivityFn, type GateLedgerPort, type OpConfig, type OpRunResult } from "@intentius/chant/op";
8
+ import * as migrationActivities from "../../op/activities/postgres-migration";
9
+ import type { PostgresMigrationDeps } from "../../op/activities/postgres-migration";
10
+ import { PostgresMigrationOp, type PostgresMigrationOpConfig } from "../migrate/op";
11
+
12
+ /** The migration activities, each called with `deps()`, as the local executor resolves them. */
13
+ export function migrationActivityMap(deps: () => PostgresMigrationDeps): Map<string, ActivityFn> {
14
+ const map = new Map<string, ActivityFn>();
15
+ for (const [name, fn] of Object.entries(migrationActivities)) {
16
+ if (typeof fn !== "function" || !name.startsWith("postgresMigration")) continue;
17
+ map.set(name, ((args: Record<string, unknown>, signal?: AbortSignal) => (fn as (a: unknown, s?: AbortSignal, d?: unknown) => Promise<unknown>)(args, signal, deps())) as ActivityFn);
18
+ }
19
+ return map;
20
+ }
21
+
22
+ /** One run of the Op through core's local executor, as far as its next gate. */
23
+ export async function runMigrationOp(config: PostgresMigrationOpConfig, gates: GateLedgerPort, deps: () => PostgresMigrationDeps): Promise<OpRunResult> {
24
+ const { op } = PostgresMigrationOp(config);
25
+ const props = (op as unknown as { props: OpConfig }).props;
26
+ return runOpLocally(props, migrationActivityMap(deps), await loadProfiles(), undefined, { gates, now: new Date().toISOString() });
27
+ }
28
+
29
+ /** An in-memory gate ledger a person approves on: each approval answers the gate the last run stopped at, for the plan it recorded. */
30
+ export class ApprovingLedger {
31
+ private pending: unknown[] = [];
32
+ private resolutions: unknown[] = [];
33
+ port = memoryGateLedgerPort();
34
+
35
+ approveLast(): void {
36
+ const last = this.port.appended.at(-1)!;
37
+ this.pending.push(...this.port.appended);
38
+ this.resolutions.push({
39
+ version: 1,
40
+ kind: "resolution",
41
+ op: last.op,
42
+ gate: last.gate,
43
+ resolvedBy: "e2e",
44
+ timestamp: new Date(Date.parse(last.timestamp) + 1000).toISOString(),
45
+ ...(last.planDigest ? { planDigest: last.planDigest } : {}),
46
+ });
47
+ this.port = memoryGateLedgerPort({ pending: this.pending as never, resolutions: this.resolutions as never });
48
+ }
49
+ }
50
+
51
+ /** An outcome attribute a run recorded. */
52
+ export const runOutcome = (r: OpRunResult, name: string): unknown => r.records.flatMap((x) => x.outcomes ?? []).find((o) => o.name === name)?.value;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The schema the live round trip creates on its source server: every object
3
+ * kind the dialect declares, with what the catalog's printers rewrite most
4
+ * (type aliases, literal casts, `IN` lists, unnamed constraints, identity and
5
+ * sequence options, storage parameters, comments), an extension and the
6
+ * domain over its type, a partitioned table and a partition, an ORM's
7
+ * revision table that import leaves out, and an object carrying chant's
8
+ * ownership trailer.
9
+ */
10
+ export const ROUNDTRIP_SCHEMA = `
11
+ CREATE SCHEMA app;
12
+ COMMENT ON SCHEMA app IS 'The shop';
13
+ CREATE EXTENSION citext WITH SCHEMA app;
14
+ CREATE TYPE app.order_status AS ENUM ('placed', 'paid', 'shipped');
15
+ CREATE DOMAIN app.email AS app.citext CONSTRAINT email_shape CHECK (VALUE LIKE '%@%');
16
+ COMMENT ON CONSTRAINT email_shape ON DOMAIN app.email IS 'needs an @';
17
+ CREATE SEQUENCE app.invoice_seq AS integer START WITH 1000 CACHE 10;
18
+ CREATE TABLE app.users (
19
+ id bigint GENERATED ALWAYS AS IDENTITY (START WITH 10) PRIMARY KEY,
20
+ email app.email NOT NULL UNIQUE,
21
+ plan text NOT NULL DEFAULT 'free' CHECK (plan IN ('free', 'pro')),
22
+ created_at timestamptz NOT NULL DEFAULT now()
23
+ ) WITH (fillfactor = 90);
24
+ COMMENT ON TABLE app.users IS 'Accounts [chant managed-by=chant stack=shop env=e2e]';
25
+ COMMENT ON COLUMN app.users.email IS 'Login name';
26
+ CREATE TABLE app.orders (
27
+ id serial PRIMARY KEY,
28
+ user_id bigint NOT NULL REFERENCES app.users (id) ON DELETE CASCADE,
29
+ invoice_no integer NOT NULL DEFAULT nextval('app.invoice_seq'),
30
+ status app.order_status NOT NULL DEFAULT 'placed',
31
+ amount numeric(12, 2) NOT NULL CONSTRAINT amount_positive CHECK (amount >= 0),
32
+ discount int DEFAULT -1,
33
+ total numeric GENERATED ALWAYS AS (amount * 2) STORED,
34
+ placed_at timestamp(3) without time zone
35
+ );
36
+ CREATE INDEX orders_user_idx ON app.orders (user_id, placed_at DESC) WHERE status <> 'shipped';
37
+ CREATE UNIQUE INDEX orders_invoice_idx ON app.orders USING btree (invoice_no) INCLUDE (amount);
38
+ CREATE TABLE app.measures (ts date NOT NULL, v double precision) PARTITION BY RANGE (ts);
39
+ CREATE TABLE app.measures_2026 PARTITION OF app.measures FOR VALUES FROM ('2026-01-01') TO ('2027-01-01');
40
+ CREATE VIEW app.order_totals AS
41
+ SELECT u.id AS user_id, u.email, count(o.id) AS n, coalesce(sum(o.amount), 0) AS total
42
+ FROM app.users u LEFT JOIN app.orders o ON o.user_id = u.id
43
+ GROUP BY u.id, u.email;
44
+ CREATE MATERIALIZED VIEW app.daily AS SELECT placed_at::date AS day, count(*) AS n FROM app.orders GROUP BY 1 WITH NO DATA;
45
+ CREATE TABLE public._prisma_migrations (id varchar(36) PRIMARY KEY, checksum varchar(64) NOT NULL);
46
+ `;