The following bug has been logged online:
Bug reference: 5793
Logged by:
Email address: ms(at)instytut(dot)com(dot)pl
PostgreSQL version: 8, 9
Operating system: Linux
Description: tsquery error
Details:
The expression 'a & !(c) | a & b' is interpreted as '( a | !c ) & a & b'.
select 'a & !(c) | a & b'::tsquery;
Subsequent "rewrites" of the same expression give inconsistent results:
select '(a & !(c | d)) | (a & b)'::tsquery; -> 'a & !(c | d) | a & b'
(correct)
select 'a & !(c | d) | a & b'::tsquery; -> '(a | !(c | d)) & a & b' (not
correct)