followed by example doesn't work

Started by Rudy Barbieriover 8 years ago6 messagesdocs
Jump to latest
#1Rudy Barbieri
barbiomalefico@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.6/static/textsearch-intro.html
Description:

I copied the text in the followed by example: SELECT to_tsvector('fatal
error') @@ to_tsquery('fatal <-> error');
but it will always goes in error: ERROR: syntax error in tsquery: "fatal
<-> error"
SQL state: 42601
I find two ways to solve the problem:
1. remove the space inside the to_tsquery string to obtain 'fatal<->error'
2. use plainto_tsquery instead of to_tsquery.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rudy Barbieri (#1)
Re: followed by example doesn't work

barbiomalefico@gmail.com writes:

I copied the text in the followed by example: SELECT to_tsvector('fatal
error') @@ to_tsquery('fatal <-> error');
but it will always goes in error: ERROR: syntax error in tsquery: "fatal
<-> error"
SQL state: 42601

The described symptoms sound like you're trying to use <-> with a pre-9.6
server. Since that feature was added in 9.6, it won't work.

We generally don't recommend reading documentation versions that don't
match your server.

regards, tom lane

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#2)
Re: followed by example doesn't work

On Sunday, December 3, 2017, Tom Lane <tgl@sss.pgh.pa.us> wrote:

barbiomalefico@gmail.com <javascript:;> writes:

I copied the text in the followed by example: SELECT

to_tsvector(&#39;fatal

error&#39;) @@ to_tsquery(&#39;fatal &lt;-&gt; error&#39;);
but it will always goes in error: ERROR: syntax error in tsquery:

&quot;fatal

&lt;-&gt; error&quot;
SQL state: 42601

The described symptoms sound like you're trying to use <-> with a pre-9.6
server. Since that feature was added in 9.6, it won't work.

We generally don't recommend reading documentation versions that don't
match your server.

My interpretation of the doc reading advice is to read the newest version
of the docs to learn about stuff but if you come across any errors, syntax
or otherwise, then read your doc version to see how older releases differ.
Non-bug enhancements to the docs are not usually back-patched and knowing
how current releases work is valuable knowledge to have.

David J.

#4Rudy Barbieri
barbiomalefico@gmail.com
In reply to: David G. Johnston (#3)
Re: followed by example doesn't work

Thanks for the tip!
But it could be better improve the documentation highlighting that in
previous versions there was a bug.

Il 03 dic 2017 5:40 PM, "David G. Johnston" <david.g.johnston@gmail.com> ha
scritto:

Show quoted text

On Sunday, December 3, 2017, Tom Lane <tgl@sss.pgh.pa.us> wrote:

barbiomalefico@gmail.com writes:

I copied the text in the followed by example: SELECT

to_tsvector(&#39;fatal

error&#39;) @@ to_tsquery(&#39;fatal &lt;-&gt; error&#39;);
but it will always goes in error: ERROR: syntax error in tsquery:

&quot;fatal

&lt;-&gt; error&quot;
SQL state: 42601

The described symptoms sound like you're trying to use <-> with a pre-9.6
server. Since that feature was added in 9.6, it won't work.

We generally don't recommend reading documentation versions that don't
match your server.

My interpretation of the doc reading advice is to read the newest version
of the docs to learn about stuff but if you come across any errors, syntax
or otherwise, then read your doc version to see how older releases differ.
Non-bug enhancements to the docs are not usually back-patched and knowing
how current releases work is valuable knowledge to have.

David J.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rudy Barbieri (#4)
Re: followed by example doesn't work

Rudy Barbieri <barbiomalefico@gmail.com> writes:

But it could be better improve the documentation highlighting that in
previous versions there was a bug.

I see no bug here ... failing to recognize an operator that was added in
later versions can hardly be classed as a bug.

regards, tom lane

#6Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#5)
Re: followed by example doesn't work

On Mon, Dec 4, 2017 at 11:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Rudy Barbieri <barbiomalefico@gmail.com> writes:

But it could be better improve the documentation highlighting that in
previous versions there was a bug.

I see no bug here ... failing to recognize an operator that was added in
later versions can hardly be classed as a bug.

If you wish to have a given operator supported in a past version of
Postgres, you could have it done in the shape of an extension as well.
There are many people and companies able to do so if you cannot.
--
Michael