Make STRING an unreserved_keyword.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 May 2022 18:05:20 +0000 (14:05 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 May 2022 18:05:20 +0000 (14:05 -0400)
commit5f0adec2537dab531ef63ff6e0fe640698a291d9
tree55e8405a62f603d2f9ae37b80e2493c909f30654
parenta8cca6026e992d9b627c7dbee5f8a50bde507a94
Make STRING an unreserved_keyword.

Commit 1a36bc9db (SQL/JSON query functions) introduced STRING as a
type_func_name_keyword, thereby breaking applications that use
"string" as a table name, column name, function parameter name, etc.
That seems like a pretty bad thing, not least because the SQL spec
says that STRING is an unreserved keyword.

This is easy enough to fix so far as the core grammar is concerned.
However, doing so causes some ECPG test cases to fail, specifically
those that use "string" as a typedef name.  It turns out this is
because portions of the ECPG grammar allow type_func_name_keywords
but not unreserved_keywords as typedef names.  That's pretty horrid,
and it's mildly astonishing that we've not heard complaints about it
before.  We can fix two of those uses trivially, but the ones in the
var_type production are less easy.  As a stopgap, hard-code STRING as
an allowed alternative in var_type.

Per report from Alastair McKinley.

Discussion: https://postgr.es/m/3661437.1653855582@sss.pgh.pa.us
src/backend/parser/gram.y
src/include/parser/kwlist.h
src/interfaces/ecpg/preproc/ecpg.trailer