Re: new function for tsquery creartion - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: new function for tsquery creartion
Date
Msg-id 20171128143916.1377.5847.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: [HACKERS] new function for tsquery creartion  (Victor Drobny <v.drobny@postgrespro.ru>)
Responses Re: new function for tsquery creartion  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, failed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Hi Victor,

I like the idea and I think it's a great patch. However in current shape it
requires some amount of reworking to meet PostgreSQL standards of code quality.

Particularly:

1. Many new procedures don't have a comment with a brief description. Ideally
every procedure should have not only a brief description but also a description
of every argument, return value and changes of global state if applicable.

2. I believe you could implement the has_prefix procedure just as a wrapper of
strstr().

3. I suggest to use snprintf instead of sprintf in a new code whenever
possible, especially if you are using %s - just to be on a safe side.

4. I noticed that your code affects the catalog. Did you check that your
changes will not cause problems during the migration from the older version of
PostgreSQL to the never one?

5. Tests for queryto_tsquery use only ASCII strings. I suggest to add a few
test that use non-ASCII characters as well, and a few corner cases like empty
string, string that contains only the stop-words, etc.

6. `make check-world` doesn't pass:

```
***************
*** 1672,1678 **** (1 row)  set enable_seqscan = on;
-  --test queryto_tsquery function select queryto_tsquery('My brand new smartphone');         queryto_tsquery        
--- 1672,1677 ----
***************
*** 1784,1786 ****
--- 1783,1786 ---- ---------------------------  'fat-rat' & 'fat' & 'rat' (1 row)
+ 
```

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Add RANGE with values and exclusions clauses to the WindowFunctions
Next
From: Alexander Korotkov
Date:
Subject: Re: [PATCH] Atomic pgrename on Windows