Re: BUG #14245: Segfault on weird to_tsquery - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14245: Segfault on weird to_tsquery
Date
Msg-id 2157.1468352545@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14245: Segfault on weird to_tsquery  (david@gravitext.com)
Responses Re: BUG #14245: Segfault on weird to_tsquery
List pgsql-bugs
david@gravitext.com writes:
> I am doing some (fuzz) testing of full text queries and managed to
> generate the following case which causes a SEGFAULT on PostgreSQL 9.6
> beta1 and beta2:
> select to_tsquery('!(a & !b) & c') as tsquery
> This weird query outputs the following on 9.5.2, instead of crashing:
> "!( !'b' ) & 'c'"

Note that while crashing is certainly not good, the pre-9.6 behavior
can hardly be called correct either.  What happened to 'a'?

Also, it looks like this is specific to to_tsquery; if you just feed
the same thing to tsqueryin, it seems fine with it:

# select '!(a & !b) & c'::tsquery;
        tsquery
-----------------------
 !( 'a' & !'b' ) & 'c'
(1 row)

            regards, tom lane

pgsql-bugs by date:

Previous
From: David Kellum
Date:
Subject: Re: BUG #14245: Segfault on weird to_tsquery
Next
From: David Kellum
Date:
Subject: Re: BUG #14245: Segfault on weird to_tsquery