[ moved to -hackers ]
Michael Fuhr <mike@fuhr.org> writes:
> On Thu, Jan 12, 2006 at 11:21:28PM -0500, Tom Lane wrote:
>> plpgsql is not very good about reserving words "minimally", ie, not
>> treating a word as a keyword outside the context where the keyword
>> is meaningful.
>>
>> This could probably be fixed, or at least greatly reduced, with some
>> flex/bison hacking. Anyone up for it?
> Possibly. Would it involve much more than what the main parser's
> grammar does with unreserved_keyword and friends? I suppose this
> ought to move to pgsql-hackers.
The keyword-classification tactic would be one approach. For the
specific case of the RAISE severity codes, I'd be inclined to eliminate
all those "keywords" entirely and let them be lexed/parsed as simple
identifiers --- there's no strong reason not to do strcmp's for specific
identifiers at the point where we're building a raise_level value.
There are probably some other methods that might apply in other places.
But in any case it's a fairly self-contained problem; you don't need
any vast knowledge of Postgres internals to tackle it, just some
understanding of the flex and bison tools.
regards, tom lane