Commit 6351d7b
fix(sql_validator): allow
The runtime renderer in `substitute_sql_params` expands an array-of-arrays
parameter into a multi-row tuple list (`(c1, c2), (c1, c2)`) so a pipeline
like `INSERT INTO docs (...) VALUES {rows}` can batch-insert without
hardcoding row count in YAML. But `preprocess_parameters` in the load-time
SQL validator always substituted `{name}` with the quoted scalar literal
`'__PARAM__'`, so the same template parsed as `VALUES '__PARAM__'` and
sqlparser rejected it with `Expected: (, found: '__PARAM__'`. Result:
skardi-server crashed during config load, the container restarted in a
loop, and any pipeline using the new tuple-list shape was unloadable.
Switch the placeholder to `(NULL)`, which parses both as a scalar
expression (`WHERE x = (NULL)`) and as a single-row VALUES tuple
(`VALUES (NULL)`), so the validator accepts every shape the runtime
renderer can emit. The validator only checks DDL/access-mode
restrictions, not types or arity, so the choice of literal is purely
about parseability.
Adds a regression test covering `VALUES {rows}` (with and without an
`ON CONFLICT` tail) and confirming access-mode enforcement still fires
on the tuple-list shape against a read-only table.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>VALUES {rows} placeholder shape at load time (#118)1 parent d548138 commit 6351d7b
1 file changed
Lines changed: 53 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
68 | 75 | | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
75 | | - | |
76 | 82 | | |
77 | | - | |
| 83 | + | |
78 | 84 | | |
79 | | - | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | | - | |
| 88 | + | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| |||
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
390 | 439 | | |
0 commit comments