Commit afea9bc
core: migrate all catalog queries to sqlc-generated code
Sweep the remaining hand-written SQL against the sql_* catalog tables
onto the generated catalogdb layer, completing the conversion started in
the types.go/FindProcs slice. Namespace, dialect, type, class,
attribute, constraint, proc, operator, and cast queries now all run
through catalogdb.Queries.
Notable rewrites:
- FindOperators: the conditionally-appended type filters become a single
static query using (@arg = 0 OR col = @arg) sentinels.
- Nullable OID columns round-trip through sql.NullInt64 (orZero maps
NULL to the 0 sentinel the Go API uses).
- New typed catalog accessors back the cross-package call sites that
previously reached into the raw handle: DropClass (ClickHouse DROP
TABLE), ClassColumns (analyzer scope), and Namespaces /
TablesInNamespace / ClassCodegenColumns (codegen catalog projection).
Only the schema bootstrap (db.Exec(ddl)) and the DB()/Close() handles
remain as raw database/sql; every catalog query is now sqlc-generated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTGxNHW6v1S1YyC9FDSgrK1 parent 1241e59 commit afea9bc
14 files changed
Lines changed: 1296 additions & 294 deletions
File tree
- internal
- cmd
- core
- analyzer
- catalogdb
- engine/clickhouse
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | | - | |
253 | 252 | | |
254 | 253 | | |
255 | | - | |
256 | | - | |
257 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
258 | 257 | | |
259 | | - | |
260 | | - | |
| 258 | + | |
| 259 | + | |
261 | 260 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
| 261 | + | |
272 | 262 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
288 | 267 | | |
289 | 268 | | |
290 | 269 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 270 | + | |
| 271 | + | |
297 | 272 | | |
298 | | - | |
299 | | - | |
300 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
301 | 276 | | |
302 | 277 | | |
303 | 278 | | |
304 | | - | |
305 | | - | |
| 279 | + | |
306 | 280 | | |
307 | | - | |
| 281 | + | |
308 | 282 | | |
309 | 283 | | |
310 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
108 | 109 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 110 | + | |
114 | 111 | | |
115 | 112 | | |
116 | 113 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
127 | 122 | | |
128 | | - | |
| 123 | + | |
129 | 124 | | |
130 | 125 | | |
131 | 126 | | |
| |||
0 commit comments