unexpected result from to_tsvector - Mailing list pgsql-hackers

From Artur Zakirov
Subject unexpected result from to_tsvector
Date
Msg-id 56CC9C9D.1050603@postgrespro.ru
Whole thread Raw
Responses Re: unexpected result from to_tsvector
List pgsql-hackers
Hello,

Here is a little patch. It fixes this issue
http://www.postgresql.org/message-id/20160217080048.26357.49416@wrigleys.postgresql.org

Without patch we get wrong result for the second email 'test@123-reg.ro':

=> SELECT * FROM ts_debug('simple', 'test@vauban-reg.ro');
  alias |  description  |       token        | dictionaries | dictionary
|       lexemes
-------+---------------+--------------------+--------------+------------+----------------------
  email | Email address | test@vauban-reg.ro | {simple}     | simple  |
{test@vauban-reg.ro}
(1 row)

=> SELECT * FROM ts_debug('simple', 'test@123-reg.ro');
    alias   |   description    | token  | dictionaries | dictionary |
lexemes
-----------+------------------+--------+--------------+------------+----------
  asciiword | Word, all ASCII  | test   | {simple}     | simple     | {test}
  blank     | Space symbols    | @      | {}           |            |
  uint      | Unsigned integer | 123    | {simple}     | simple     | {123}
  blank     | Space symbols    | -      | {}           |            |
  host      | Host             | reg.ro | {simple}     | simple     |
{reg.ro}
(5 rows)

After patch we get correct result for the second email:

=> SELECT * FROM ts_debug('simple', 'test@123-reg.ro');
  alias |  description  |      token      | dictionaries | dictionary |
       lexemes
-------+---------------+-----------------+--------------+------------+----------------------
  email | Email address | test@123-reg.ro | {simple}     | simple  |
{test@123-reg.ro}
(1 row)

This patch allows to parser work with emails 'test@123-reg.ro',
'123@123-reg.ro' and 'test@123_reg.ro' correctly.

--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] JDBC behaviour
Next
From: Bruce Momjian
Date:
Subject: Re: pg_export_snapshot on standby side