From: | Oleg Bartunov <obartunov(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Precedence of new phrase search tsquery operator |
Date: | 2016-06-08 16:59:33 |
Message-ID: | CAF4Au4wSSxkdJCNruSJxgKX_PGWZ9y6RYDPiWrNF0Yi89tbOAw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 8, 2016 at 7:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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?
I don't remember, but it looks like a bug. I found another issue with that
If some dictionary returns two infinitives, like:
select * from to_tsquery('en','leavings');
to_tsquery
----------------------
'leavings' | 'leave'
(1 row)
then following query looks like a bug
select to_tsquery('en', 'aa & leavings <-> tut');
to_tsquery
-------------------------------------------------------------------
( 'aa' <-> 'tut' ) & ( 'leavings' <-> 'tut' | 'leave' <-> 'tut' )
(1 row)
It should be definitely
select to_tsquery('en', 'aa & leavings <-> tut');
to_tsquery
-------------------------------------------------------------------
'aa' & ( 'leavings' <-> 'tut' | 'leave' <-> 'tut' )
(1 row)
so, yes, <-> should be more tight than &.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2016-06-08 17:08:53 | Re: Precedence of new phrase search tsquery operator |
Previous Message | Tom Lane | 2016-06-08 16:13:29 | Precedence of new phrase search tsquery operator |