Commit a92683d
fix: resolve critical nil pointer dereferences in ALTER parser (#101)
* fix: resolve critical nil pointer dereferences in ALTER parser
Fixes three critical nil pointer dereference bugs discovered during
comprehensive error recovery testing:
1. ALTER TABLE DROP COLUMN - missing column name check (line 61)
2. ALTER TABLE DROP CONSTRAINT - missing constraint name check (line 72)
3. ALTER TABLE ALTER COLUMN - missing column name check (line 109)
All three cases now properly check if parseIdent() returns nil before
accessing the Name field, returning appropriate error messages instead
of crashing.
These bugs would have caused production crashes when parsing invalid
ALTER statements missing required identifier tokens.
Fixes issues discovered in TEST-013: Parser Error Recovery Tests
* fix: add nil checks for RENAME COLUMN operations
Addresses code review feedback by adding nil checks for both
the old column name and new column name in RENAME COLUMN operations.
This completes the nil pointer dereference fixes for ALTER TABLE
statements by handling all parseIdent() calls that could return nil.
Changes:
- Added nil check after parseIdent() for old column name (line 91)
- Added nil check after parseIdent() for new column name (line 100)
- Returns descriptive error messages for missing identifiers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini.local>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 265cf4f commit a92683d
1 file changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
| |||
100 | 112 | | |
101 | 113 | | |
102 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
103 | 118 | | |
104 | 119 | | |
105 | 120 | | |
| |||
0 commit comments