Call for objections: revision of keyword classification

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgreSQL(dot)org
Subject: Call for objections: revision of keyword classification
Date: 2001-11-09 00:44:44
Message-ID: 18112.1005266684@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Since we've already seen two complaints about "timestamp" no longer
being an allowed column name in 7.2, I think it's probably time to
make a serious effort at trimming the reserved-word list a little.

The attached patch de-reserves all these former ColLabels:

ABORT unrestricted
BIT can be ColId, but not function name
CHAR can be ColId, but not function name
CHARACTER can be ColId, but not function name
CLUSTER unrestricted
COPY unrestricted
DEC can be ColId, but not function name
DECIMAL can be ColId, but not function name
EXPLAIN unrestricted
FLOAT can be ColId, but not function name
GLOBAL unrestricted
INOUT unrestricted
INTERVAL can be ColId, but not function name
LISTEN unrestricted
LOAD unrestricted
LOCAL unrestricted
LOCK unrestricted
MOVE unrestricted
NCHAR can be ColId, but not function name
NUMERIC can be ColId, but not function name
OUT unrestricted
PRECISION unrestricted
RESET unrestricted
SETOF can be ColId, but not type or function name
SHOW unrestricted
TIME can be ColId, but not function name
TIMESTAMP can be ColId, but not function name
TRANSACTION unrestricted
UNKNOWN unrestricted
VACUUM unrestricted
VARCHAR can be ColId, but not function name

The ones that are now unrestricted were just low-hanging fruit (ie,
they probably should never have been in ColLabel in the first place).
The rest were fixed by recognizing that just because something couldn't
be a function name didn't mean it couldn't be used as a table or column
name. This solves the fundamental shift/reduce conflict posed by cases
like "SELECT TIMESTAMP(3 ...", without also preventing people from
continuing to name their columns "timestamp".

The keyword classification now looks like:

TypeFuncId: IDENT plus all fully-unrestricted keywords

ColId: TypeFuncId plus type-name keywords that might be
followed by '('; these can't be allowed to be
function names, but they can be column names.

func_name: TypeFuncId plus a few special-case ColLabels
(this list could probably be extended further)

ColLabel: ColId plus everything else

Comments? I'd like to apply this, unless there are objections.
I suppose Peter might complain about having to redo the keyword
tables ;-)

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 21.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-09 01:24:42 Re: [HACKERS] PostgreSQL v7.2b2 Released
Previous Message Jim Buttafuoco 2001-11-08 22:08:00 Re: Storage Location Patch Proposal for V7.3

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-11-09 02:05:07 Re: Call for objections: revision of keyword classification
Previous Message Bruce Momjian 2001-11-08 20:41:43 Re: Fix for 'extern "C"' indenting