Re: Empty string in lexeme for tsvector

2021-11-03 Thread Tom Lane
Jean-Christophe Arnu writes: >> (By the same token, I think there's a good argument for >> tsvector_delete_arr to just ignore nulls, not throw an error. >> That's a somewhat orthogonal issue, though.) > Nulls are now ignored in tsvector_delete_arr(). I think setweight() with an array should hand

Re: Empty string in lexeme for tsvector

2021-09-30 Thread Jean-Christophe Arnu
Thank you Tom for your review. Le mer. 29 sept. 2021 à 21:36, Tom Lane a écrit : > Jean-Christophe Arnu writes: > > [ empty_string_in_tsvector_v4.patch ] > > I looked through this patch a bit. I don't agree with adding > these new error conditions to tsvector_setweight_by_filter and > tsvector

Re: Empty string in lexeme for tsvector

2021-09-29 Thread Tom Lane
Jean-Christophe Arnu writes: > [ empty_string_in_tsvector_v4.patch ] I looked through this patch a bit. I don't agree with adding these new error conditions to tsvector_setweight_by_filter and tsvector_delete_arr. Those don't prevent bad lexemes from being added to tsvectors, so AFAICS they can

Re: Empty string in lexeme for tsvector

2021-09-27 Thread Jean-Christophe Arnu
Le dim. 26 sept. 2021 à 22:41, Jean-Christophe Arnu a écrit : > > > Le dim. 26 sept. 2021 à 15:55, Artur Zakirov a écrit : > >> Nice catch! The patch looks good to me. >> Can you also add a more general test case: >> >> =# SELECT $$'' '1' '2'$$::tsvector; >> ERROR: syntax error in tsvector: "''

Re: Empty string in lexeme for tsvector

2021-09-26 Thread Jean-Christophe Arnu
Le dim. 26 sept. 2021 à 15:55, Artur Zakirov a écrit : > Nice catch! The patch looks good to me. > Can you also add a more general test case: > > =# SELECT $$'' '1' '2'$$::tsvector; > ERROR: syntax error in tsvector: "'' '1' '2'" > LINE 1: SELECT $$'' '1' '2'$$::tsvector; > > Thank you, Artur fo

Re: Empty string in lexeme for tsvector

2021-09-26 Thread Artur Zakirov
On Fri, Sep 24, 2021 at 2:39 PM Jean-Christophe Arnu wrote: > Here's a new patch file taking your comments into account. Nice catch! The patch looks good to me. Can you also add a more general test case: =# SELECT $$'' '1' '2'$$::tsvector; ERROR: syntax error in tsvector: "'' '1' '2'" LINE 1: S

Re: Empty string in lexeme for tsvector

2021-09-24 Thread Ranier Vilela
Em sex., 24 de set. de 2021 às 09:39, Jean-Christophe Arnu escreveu: > > > Le ven. 24 sept. 2021 à 13:03, Ranier Vilela a > écrit : > >> >> Comments are more than welcome! >>> >> 1. Would be better to add this test-and-error before tsvector_bsearch >> call. >> >> + if (lex_len == 0) >> + ereport

Re: Empty string in lexeme for tsvector

2021-09-24 Thread Jean-Christophe Arnu
Le ven. 24 sept. 2021 à 13:03, Ranier Vilela a écrit : > > Comments are more than welcome! >> > 1. Would be better to add this test-and-error before tsvector_bsearch call. > > + if (lex_len == 0) > + ereport(ERROR, > + (errcode(ERRCODE_ZERO_LENGTH_CHARACTER_STRING), > + errmsg("lexeme array may n

Re: Empty string in lexeme for tsvector

2021-09-24 Thread Ranier Vilela
Em sex., 24 de set. de 2021 às 05:47, Jean-Christophe Arnu escreveu: > Hello Hackers, > > This is my second proposal for a patch, so I hope not to make "rookie" > mistakes. > > This proposal patch is based on a simple use case : > > If one creates a table this way > CREATE TABLE tst_table AS (SEL