Commit 40634d8
Fix DuckLake concurrent attachment and DDL rewriting for ETL tools
Two fixes for DuckLake compatibility:
1. Fix DDL rewriting for ETL tool queries (e.g., queries with /*comment*/ prefixes):
- rewriteForDuckLake now strips leading SQL comments before detecting CREATE TABLE
- Added createTableDetectRegex to handle multiple spaces (e.g., "CREATE TABLE")
- PRIMARY KEY and other constraints are now properly stripped from these queries
2. Fix DuckLake attachment race condition:
- Multiple connections attaching simultaneously caused "__ducklake_metadata_ducklake already exists"
- Moved mutex to attachDuckLake to serialize both secret creation and catalog attachment
- Added check for existing DuckLake catalog before attempting attachment
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent ceed599 commit 40634d8
3 files changed
+46
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
| |||
603 | 605 | | |
604 | 606 | | |
605 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
606 | 619 | | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
611 | 624 | | |
612 | 625 | | |
613 | 626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
153 | 164 | | |
154 | 165 | | |
155 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
311 | 328 | | |
312 | 329 | | |
313 | 330 | | |
| |||
359 | 376 | | |
360 | 377 | | |
361 | 378 | | |
| 379 | + | |
362 | 380 | | |
363 | 381 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | 382 | | |
370 | 383 | | |
371 | 384 | | |
| |||
0 commit comments