Commit faaf058
fix(postgresql): add jsontype rule and fix REVERSE keyword
Fix test failures by adding missing JsonType support and making REVERSE
available as a function name.
Changes:
1. Add jsontype rule matching PostgreSQL's gram.y:
- jsontype: JSON
- Added to simpletypename (for general type references)
- Added to consttypename (for constant type references)
2. Add REVERSE to plsql_unreserved_keyword:
- REVERSE is a PL/pgSQL token but should be usable as a function name
- Now matches type_function_name via plsql_unreserved_keyword path
Root Cause Analysis:
- PostgreSQL's grammar has explicit JsonType rule for JSON keyword
- Our grammar was missing this, causing ::json typecast to fail
- JSON is a col_name_keyword, not in type_function_name categories
- Without jsontype rule, parser tried qualified_name%TYPE_P path
- REVERSE was in old builtin_function_name rule (now removed)
- After removal, REVERSE token couldn't be used as function name
- Solution: Add to plsql_unreserved_keyword to allow SQL usage
Test Results:
✅ All previously failing tests now pass:
- json_encoding.sql
- json.sql
- jsonb.sql
- join_hash.sql
- builtin_functions_string.sql
- text.sql
✅ Full test suite passes with no regressions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 3859fde commit faaf058
File tree
6 files changed
+14117
-13928
lines changed- postgresql
6 files changed
+14117
-13928
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3194 | 3194 | | |
3195 | 3195 | | |
3196 | 3196 | | |
| 3197 | + | |
3197 | 3198 | | |
3198 | 3199 | | |
3199 | 3200 | | |
3200 | 3201 | | |
3201 | 3202 | | |
3202 | 3203 | | |
3203 | 3204 | | |
| 3205 | + | |
3204 | 3206 | | |
3205 | 3207 | | |
3206 | 3208 | | |
3207 | 3209 | | |
3208 | 3210 | | |
3209 | 3211 | | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
3210 | 3216 | | |
3211 | 3217 | | |
3212 | 3218 | | |
| |||
4835 | 4841 | | |
4836 | 4842 | | |
4837 | 4843 | | |
| 4844 | + | |
4838 | 4845 | | |
4839 | 4846 | | |
4840 | 4847 | | |
| |||
0 commit comments