On 12/17/18, Tom Lane <t...@sss.pgh.pa.us> wrote: > John Naylor <jcnay...@gmail.com> writes: >> Since PL/pgSQL uses the core scanner, we'd need to use offsets in its >> reserved_keywords[], too. Those don't change much, so we can probably >> get away with hard-coding the offsets and the giant string in that >> case. (If that's not acceptable, we could separate that out to >> pl_reserved_kwlist.h and reuse the above tooling to generate >> pl_reserved_kwlist_{offset,string}.h, but that's more complex.) > > plpgsql isn't as stable as all that: people propose new syntax for it > all the time. I do not think a hand-maintained array would be pleasant > at all.
Okay. > Also, wouldn't we also adopt this technology for its unreserved keywords, > too? We wouldn't be forced to, but there might be other reasons to do so. Were you thinking of code consistency (within pl_scanner.c or globally)? Or something else? If we did adopt this setup for plpgsql unreserved keywords, ecpg/preproc/ecpg_keywords.c and ecpg/preproc/c_keywords.c would be left using the current ScanKeyword struct for search. Using offset search for all 5 types of keywords would be globally consistent, but it also means additional headers, generated headers, and makefile rules. -John Naylor