Re: [HACKERS] Keywords - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] Keywords
Date
Msg-id 36C0EEBA.9FDD6961@alumni.caltech.edu
Whole thread Raw
In response to Keywords  (Michael Meskes <Michael_Meskes@topmail.de>)
Responses Re: [HACKERS] Keywords
List pgsql-hackers
Hannu Krosing wrote:
> 
> Michael Meskes wrote:
> >
> > On Mon, Feb 08, 1999 at 01:15:09PM -0500, Bruce Momjian wrote:
> > > We don't reserve the type names as keywords, and because they can 
> > > create their own types, it wouldn't make sense.
> > I don't exactly understand that. For instance the 'int' keyword will 
> > still be reserved, isn't it?
> hannu=> create table int(int int);
> CREATE
> hannu=> create table int4(int4 int4);
> ERROR:  TypeCreate: type int4 already defined
> So it's probably not reserved ;)

INT is an SQL92 reserved word. But it is not a reserved word in
Postgres, since the usage as a reserved word would be exclusively as a
type name. In Postgres, the parser does not require a type name to be
explicitly defined as a keyword (which would make it a de facto reserved
word) since we allow type extensibility. Parsing it explicitly as a
keyword does not buy us any new functionality (since we allow type names
which are definitely *not* keywords anyway), so we don't do it.

However, it is handled in a special way: in contexts where one would
expect a type name, "int" is translated to "int4" explicitly (very early
on, from gram.y). Otherwise it is not translated.
                    - Tom


pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] TIME QUALIFICATION
Next
From: Tatsuo Ishii
Date:
Subject: cannot cast bpchar and varchar