Commit f2022cf
Allow DEFAULT keyword in UPDATE for generated columns (issue #9438)
This commit fixes issue #9438 where updating a generated column with
the DEFAULT keyword was incorrectly rejected. The previous validation
logic prevented any UPDATE of generated columns without checking if
the value being assigned was DEFAULT.
Changes:
- Modified validation in dml.go to allow DEFAULT expressions for generated columns
- For generated columns, DEFAULT now correctly uses the generated expression
- Added comprehensive test case covering various UPDATE scenarios
- Maintains existing validation that rejects non-DEFAULT values for generated columns
MySQL behavior:
- `UPDATE t SET generated_col = DEFAULT` should succeed (now works)
- `UPDATE t SET generated_col = value` should fail (still works)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent ffdc4a9 commit f2022cf
File tree
2 files changed
+57
-4
lines changed- enginetest/queries
- sql/planbuilder
2 files changed
+57
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
98 | 139 | | |
99 | 140 | | |
100 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
296 | 303 | | |
297 | 304 | | |
298 | 305 | | |
299 | 306 | | |
300 | 307 | | |
301 | | - | |
| 308 | + | |
302 | 309 | | |
303 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
304 | 316 | | |
305 | 317 | | |
306 | 318 | | |
| |||
0 commit comments