Commit c503c9b
Dylan Bobby Storey
fix(transform): T-0306 follow-on — varlen MATCH with WITH-bound vars no longer emits column-ref as table alias
When a varlen pattern reuses variables bound via a prior WITH (e.g.
\`MATCH (first)-[rs*]->(second)\` where first/second/rs came from a
preceding WITH projection), the rel/target variable aliases are
column references like \`_with_0.rs\` — using those as SQL table
aliases produced 'CROSS JOIN _varlen_path_1 AS _with_0.rs' which
fails parsing (SQLite treats . as a column accessor).
Two coordinated changes in transform_match.c's varlen branch:
1. Detect alias-is-colref by substring '.' on edge_alias /
target_alias. Either alias_is_id=true (id-from-WITH) or
kind=PROJECTED scalar projection produces a dot in the alias.
2. When edge alias is colref: substitute a fresh internal alias
(_vp_inner_N) for the CTE JOIN, keep all downstream WHERE
constraints using that fresh alias. The bound rel column ref
isn't referenced — for now the bound rs list isn't matched
against the iterated path (that's a separate semantic issue,
already filed under T-0306).
3. When target alias is colref: skip the 'CROSS JOIN nodes AS
<colref>' emission entirely. The downstream WHERE constraint
('_vp_inner_N.end_id = <colref>') uses the column ref directly,
so no fresh nodes table is needed.
Match9 [6]/[7] / Match4 [8] no longer produce 'near .:' parse errors.
TCK delta: pass=3466 → 3468 (+2), errors=77 → 74 (-3), fails=283 →
284 (+1). The one extra fail moves to result-mismatch territory
(bound-list-vs-iterated-path semantic, separate). 944/944 unit,
functional clean.1 parent 536880b commit c503c9b
1 file changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1172 | 1172 | | |
1173 | 1173 | | |
1174 | 1174 | | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1175 | 1201 | | |
1176 | 1202 | | |
1177 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
1178 | 1213 | | |
1179 | 1214 | | |
1180 | 1215 | | |
| |||
1242 | 1277 | | |
1243 | 1278 | | |
1244 | 1279 | | |
| 1280 | + | |
1245 | 1281 | | |
1246 | 1282 | | |
1247 | 1283 | | |
| |||
0 commit comments