Precedence of new phrase search tsquery operator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Bartunov <obartunov(at)gmail(dot)com>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Precedence of new phrase search tsquery operator
Date: 2016-06-08 16:13:29
Message-ID: 32260.1465402409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It appears that the new <-> operator has been made to have exactly the
same grammatical precedence as the existing & (AND) operator. Thus,
for example, 'a & b <-> c'::tsquery means something different from
'b <-> c & a'::tsquery:

regression=# select 'a & b <-> c'::tsquery;
tsquery
-----------------------------------
( 'a' <-> 'c' ) & ( 'b' <-> 'c' )
(1 row)

regression=# select 'b <-> c & a'::tsquery;
tsquery
-----------------------
( 'b' <-> 'c' ) & 'a'
(1 row)

I find this surprising. My intuitive feeling is that <-> ought to
bind tighter than & (and therefore also tighter than |). What's
the reasoning for making it act like this?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2016-06-08 16:59:33 Re: Precedence of new phrase search tsquery operator
Previous Message Amit Kapila 2016-06-08 16:01:39 Re: Reviewing freeze map code