Commit a1900a3
adarshsm
Group ROLE as an identifier when used as a column name (issue798)
ROLE is a non-reserved keyword, so it can also be a column name, but the
lexer always tokenized it as a keyword and `group_identifier` only wraps
Name/String.Symbol tokens. As a result `SELECT a, role, b` left `role` as a
bare keyword while `a` and `b` became Identifiers, so `get_identifiers()`
returned it inconsistently.
Simply dropping ROLE from the keyword list is not viable: it would make
`CREATE ROLE r` parse as an identifier aliased to the role name. Instead,
add `group_identifier_role`, which wraps ROLE in an Identifier only when it
sits in an identifier list (flanked by a comma). Outside a list -- e.g.
`CREATE ROLE`, `SET ROLE`, `DROP ROLE` -- there is no adjacent comma, so it
keeps its keyword role. This mirrors the existing `('null', 'role')`
special-case already present in `group_identifier_list`.1 parent 60cdc64 commit a1900a3
3 files changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
257 | 278 | | |
258 | 279 | | |
259 | 280 | | |
| |||
457 | 478 | | |
458 | 479 | | |
459 | 480 | | |
| 481 | + | |
460 | 482 | | |
461 | 483 | | |
462 | 484 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
244 | 264 | | |
245 | 265 | | |
246 | 266 | | |
| |||
0 commit comments