Re: Making OFF unreserved - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Making OFF unreserved
Date
Msg-id 21367.1287755687@sss.pgh.pa.us
Whole thread Raw
In response to Making OFF unreserved  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Making OFF unreserved
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> OFF is a reserved keyword. It's not a reserved keyword in the SQL spec, 
> and it's not hard to see people using off as a variable or column name, 
> so it would be nice to relax that.

While I can see the value of doing something about that, this seems
awfully fragile:

> +            /*
> +             * OFF is also accepted as a boolean value, but is not listed
> +             * here to avoid making it a reserved keyword. All uses of
> +             * opt_boolean rule also accept a ColId with the same action -
> +             * OFF is handled via that route.
> +             */

The production's correctness now depends on how it's used, and there's
no way to prevent somebody from misusing it.

I think it'd be better if you were to refactor the grammar so that ColId
was actually one of the alternatives in this very production (call it
opt_boolean_or_name, or something like that).  Then at least there'd be
less of a flavor of action-at-a-distance about the assumption that OFF
was handled in a compatible fashion.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Extensions, this time with a patch
Next
From: Dimitri Fontaine
Date:
Subject: Re: Extensions, this time with a patch