Hi! I see that patch changes existing regression tests in tsearch2.out.
*** a/contrib/tsearch2/expected/tsearch2.out --- b/contrib/tsearch2/expected/tsearch2.out *************** SELECT '(!1|2)&3'::tsquery; *** 278,292 **** (1 row) SELECT '1|(2|(4|(5|6)))'::tsquery; ! tsquery ! ----------------------------------------- ! '1' | ( '2' | ( '4' | ( '5' | '6' ) ) ) (1 row) SELECT '1|2|4|5|6'::tsquery; ! tsquery ! ----------------------------------------- ! ( ( ( '1' | '2' ) | '4' ) | '5' ) | '6' (1 row) SELECT '1&(2&(4&(5&6)))'::tsquery; --- 278,292 ---- (1 row) SELECT '1|(2|(4|(5|6)))'::tsquery; ! tsquery ! ----------------------------- ! '1' | '2' | '4' | '5' | '6' (1 row) SELECT '1|2|4|5|6'::tsquery; ! tsquery ! ----------------------------- ! '1' | '2' | '4' | '5' | '6' (1 row) This change looks like improvement, without braces tsquery readability is much better. *************** select rewrite('moscow & hotel', 'select *** 461,469 **** (1 row) select rewrite('bar & new & qq & foo & york', 'select keyword, sample from test_tsquery'::text ); ! rewrite ! ------------------------------------------------------------------------------------- ! 'citi' & 'foo' & ( 'bar' | 'qq' ) & ( 'nyc' | ( 'big' & 'appl' | 'new' & 'york' ) ) (1 row) select rewrite( ARRAY['moscow', keyword, sample] ) from test_tsquery; --- 461,469 ---- (1 row) select rewrite('bar & new & qq & foo & york', 'select keyword, sample from test_tsquery'::text ); ! rewrite ! --------------------------------------------------------------------------------- ! ( 'nyc' | 'big' & 'appl' | 'new' & 'york' ) & 'citi' & 'foo' & ( 'bar' | 'qq' ) (1 row) select rewrite( ARRAY['moscow', keyword, sample] ) from test_tsquery; However, such reorderings look unclear and need motivation. ------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company