Commit 0334707
User
fix(sqlite): normalize column names in ALTER TABLE ADD/DROP COLUMN
Fixes #4307
When ALTER TABLE ADD COLUMN or DROP COLUMN statements use mixed-case
column names (e.g., barBaz), the column name was stored in the catalog
with its original case. However, SELECT queries normalize all unquoted
identifiers to lowercase via the identifier() function, causing a
mismatch and 'column does not exist' errors.
This fix ensures ALTER TABLE ADD/DROP COLUMN also normalize column names
using identifier(), matching the behavior of CREATE TABLE and SELECT
queries. This aligns with SQLite's case-insensitive identifier handling.
Changes:
- internal/engine/sqlite/convert.go: Apply identifier() to column names
in ALTER TABLE ADD COLUMN and DROP COLUMN handlers
- internal/engine/sqlite/catalog_test.go: Add regression test for
mixed-case column names in ALTER TABLE ADD COLUMN1 parent 744558d commit 0334707
2 files changed
+34
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
85 | 117 | | |
86 | 118 | | |
87 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
0 commit comments