* Check whether a variable's name is allowed. * * We allow any non-ASCII character, as well as ASCII letters, digits, and * underscore. Keep this in sync with the definition of variable_char in * psqlscan.l and psqlscanslash.l. */
| 19 | * psqlscan.l and psqlscanslash.l. |
| 20 | */ |
| 21 | static bool |
| 22 | valid_variable_name(const char *name) |
| 23 | { |
| 24 | const unsigned char *ptr = (const unsigned char *) name; |
| 25 | |
| 26 | /* Mustn't be zero-length */ |
| 27 | if (*ptr == '\0') |
| 28 | return false; |
| 29 | |
| 30 | while (*ptr) |
| 31 | { |
| 32 | if (IS_HIGHBIT_SET(*ptr) || |
| 33 | strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" |
| 34 | "_0123456789", *ptr) != NULL) |
| 35 | ptr++; |
| 36 | else |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | return true; |
| 41 | } |
| 42 | |
| 43 | /* |
| 44 | * A "variable space" is represented by an otherwise-unused struct _variable |
no outgoing calls
no test coverage detected