Commit 2a1523b
committed
fix(clickhouse): unwrap parenthesized PRIMARY_KEY independent of ORDER_BY
The PRIMARY_KEY branch in _build_table_properties_exp tested the ORDER_BY
value (ordered_by_raw) for exp.Paren instead of the primary_key value, a
copy-paste leftover from the ORDER_BY block above it. As a result a single
parenthesized PRIMARY_KEY such as PRIMARY_KEY = (a) was only unwrapped when
ORDER_BY also happened to be a Paren; with a bare column, a tuple, or no
ORDER_BY the parentheses were kept and the adapter emitted the malformed
PRIMARY KEY ((a)). The generated primary key wrongly depended on the
unrelated ORDER_BY shape.
Check primary_key for exp.Paren so it is unwrapped regardless of ORDER_BY,
and add regression cases pairing PRIMARY_KEY = (a) with a bare and a tuple
ORDER_BY.
Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>1 parent b0bc176 commit 2a1523b
2 files changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
850 | 850 | | |
851 | 851 | | |
852 | 852 | | |
853 | | - | |
| 853 | + | |
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
308 | 322 | | |
309 | 323 | | |
310 | 324 | | |
| |||
0 commit comments