Re: A really subtle lexer bug

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A really subtle lexer bug
Date: 2018-08-23 15:29:23
Message-ID: 871sap1658.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>> Patch attached.
>> This fixes two bugs: first the mis-lexing of two-char ops as mentioned
>> originally; second, the O(N^3) lexing time of strings of - or +
>> characters is reduced to O(N^2) (in practice it's better than O(N^2)
>> once N gets large because the bison stack gets blown out, ending the
>> loop early).

Tom> Looks reasonable offhand (didn't test). A couple of thoughts:

Tom> * Some regression tests exercising these code paths might be a
Tom> good thing.

Agreed. Any preferences where they should go?

Tom> * There should likely be a comment near where EQUALS_GREATER and
Tom> friends are defined, pointing out that if we add any more
Tom> multi-character operators with special precedences, this code has
Tom> to be taught about them.

Agreed; will do this.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2018-08-23 15:35:13 Re: Memory leak with CALL to Procedure with COMMIT.
Previous Message Finnerty, Jim 2018-08-23 15:29:04 Re: Removing useless DISTINCT clauses