pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oleg Bartunov <obartunov@gmail.com>
To: Teodor Sigaev <teodor@sigaev.ru>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [sqlsmith] Failed assertion in TS_phrase_execute
Date: Thu, 15 Dec 2016 18:25:03 -0500
Message-ID: <29507.1481844303@sss.pgh.pa.us> (raw)
In-Reply-To: <24331.1480199636@sss.pgh.pa.us>
References: <87eg1y2s3x.fsf@credativ.de>
	<14732.1480186277@sss.pgh.pa.us>
	<24331.1480199636@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

I wrote:
>> but I notice that some normalization seems to be getting done by
>> tsqueryin:

>> regression=# select $$( 'sanct' & 'peter' ) <-> ( 'sanct' & 'peter' )$$::tsquery;
>>                                     tsquery                                 
>> ---------------------------------------------------------------------------------------
>>  'sanct' <-> 'sanct' & 'peter' <-> 'sanct' & 'sanct' <-> 'peter' & 'peter' <-> 'peter'
>> (1 row)

> BTW, it seems like that normalization is wrong.  The transformed query
> should (and does) match the string "sanct sanct peter sanct sanct peter
> peter peter", since each of the <-> pairs has a match somewhere in there.
> But I would expect the original query to be specifying that a match occurs
> at exactly one place, which of course is unsatisfiable since 'sanct' and
> 'peter' can't match the same word.

After further thought, it seems like a correct transformation would be
to replace & underneath a PHRASE operator with <0>, ie

	('a' & 'b') <N> ('c' & 'd')

becomes

	('a' <0> 'b') <N> ('c' <0> 'd')

This would have the same effect of getting rid of non-PHRASE operators
underneath a PHRASE, and it would produce what seems to me much less
surprising results, ie you get a match only when both sides of the &
can match at the same place.  Comments?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (4+ messages)

Message-ID: <29507.1481844303@sss.pgh.pa.us>
Permalink:  ../29507.1481844303@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29507.1481844303@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, obartunov@gmail.com, teodor@sigaev.ru, seltenreich@gmx.de
  Subject: Re: [sqlsmith] Failed assertion in TS_phrase_execute
  In-Reply-To: <29507.1481844303@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox