Re: Making OFF unreserved

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making OFF unreserved
Date: 2010-10-22 14:47:08
Message-ID: 4CC1A3EC.20504@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 22.10.2010 16:54, Tom Lane wrote:
> Heikki Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)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.

Ah yes, that's much better. Committed that way.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-10-22 15:19:48 Re: crash in plancache with subtransactions
Previous Message Tom Lane 2010-10-22 14:30:34 Re: Extensions, this time with a patch