Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group