Commit 9742a30
committed
Close combined-case gap: backtick AND default-escape char in same name
A column named e.g. `col`x.y` (literal backtick + dot) failed to
round-trip because the two escape mechanisms interacted incorrectly:
1. Our override doubles the backtick: name -> `col``x.y`
2. Super's bindname_escape_characters then translates the dot:
name -> `col``x_y`, escaped_from -> `col``x.y`
3. escaped_bind_names records {col``x.y: col``x_y}
4. bind_names[bindparam] is the original `col`x.y` (single backtick,
set by _truncate_bindparam before our override runs)
5. construct_params looks up `col`x.y` in escaped_bind_names —
misses (the key is doubled), so dict key stays `col`x.y`
6. Server parses marker name `col`x_y` (dot translated, backtick
un-doubled), looks up `col`x_y` in the dict — UNBOUND.
Fix: when our override doubles backticks, render the marker fully
ourselves rather than delegating to super. Keeps escaped_bind_names
empty for these names so construct_params passes the original key
through unchanged. Super's escape map can no longer interact with our
doubled name. The non-backtick path (e.g. plain `col.x`) is unchanged
and still goes through super.
Adds a unit test and an end-to-end audit case for `col`x.y`. Audit is
now 43/43 (added 2 new assertions for the combined case). Vanishingly
rare in practice but it's the last realistic edge case I could
identify; closing it removes the only known correctness gap.
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 2c1bc55 commit 9742a30
3 files changed
Lines changed: 653 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | 157 | | |
148 | 158 | | |
149 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
150 | 166 | | |
151 | 167 | | |
152 | 168 | | |
| |||
0 commit comments