Re: new function for tsquery creartion

Aleksander Alekseev <a.alekseev@postgrespro.ru>

From: Aleksander Alekseev <a.alekseev@postgrespro.ru>
To: pgsql-hackers@lists.postgresql.org
Cc: Victor Drobny <v.drobny@postgrespro.ru>
Date: 2018-01-15T13:00:55Z
Lists: pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            tested, passed

Here are a few minor issues:

```
+/*
+ * Checks if 'str' starts with a 'prefix'
+ */
+static bool
+has_prefix(char * str, char * prefix)
+{
+   if (strlen(prefix) > strlen(str))
+   {
+       return false;
+   }
+   return strstr(str, prefix) == str;
+}
```

strlen() check is redundant.

```
+           case OP_AROUND:
+               snprintf(in->cur, 256, " AROUND(%d) %s", distance, nrm.buf);
+               break;
```

Instead of the constant 256 it's better to use sizeof().

Apart from these issues this patch looks not bad.

The new status of this patch is: Ready for Committer

Commits

  1. Add websearch_to_tsquery

  2. Add psql variables to track success/failure of SQL queries.

  3. Wording improvements