pgsql: Make STRING an unreserved_keyword.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make STRING an unreserved_keyword.
Date: 2022-05-30 18:05:32
Message-ID: E1nvjlk-001uEh-5i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5f0adec2537dab531ef63ff6e0fe640698a291d9

Modified Files
--------------
src/backend/parser/gram.y | 2 +-
src/include/parser/kwlist.h | 2 +-
src/interfaces/ecpg/preproc/ecpg.trailer | 41 ++++++++++++++++++++++++++++++--
3 files changed, 41 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2022-05-31 00:08:15 pgsql: Add debugging help in OwnLatch().
Previous Message Peter Eisentraut 2022-05-30 05:30:01 pgsql: logging: Also add the command prefix to detail and hint messages