Repository navigation
Commit d760fb4
committed
fix(db2): normalize_identifiers before quoting to fix CTE alias case mismatch (SQL0204N)
_fetch_native_df forced quote_identifiers=True to preserve case-sensitive column
lookups. However quote_identifiers wraps unquoted identifiers with their original
(pre-normalisation) case, so a CTE alias 'c' (unquoted) became '"c"' while the
UPPERCASE normalisation strategy causes the SELECT reference to be '"C"' — a
case-sensitive mismatch on Db2 causing SQL0204N.
Fix: apply normalize_identifiers(dialect='db2') before the quote step so unquoted
identifiers are uppercased first (c → C → "C"), matching the SELECT reference.
Quoted identifiers are intentionally unchanged by normalize_identifiers.
Also update test_dialects expected_columns to include db2 in the uppercase branch:
Db2 returns column names in uppercase (W, X, Y, Z) for both quoted and unquoted
column aliases, same as Snowflake.1 parent 99422b4 commit d760fb4
2 files changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
776 | 777 | | |
777 | 778 | | |
778 | 779 | | |
779 | | - | |
780 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
781 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
782 | 793 | | |
783 | 794 | | |
784 | 795 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2636 | 2636 | | |
2637 | 2637 | | |
2638 | 2638 | | |
2639 | | - | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2640 | 2643 | | |
2641 | 2644 | | |
2642 | 2645 | | |
| |||
0 commit comments