Search Postgresql Archives

tsvector string representation and parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,

I am constructing a tsvector representation of some text manually because I need to provide explicit positional parameters. In some cases, the conversion fails and I get a "syntax error in tsvector".

This is a minimal example that goes wrong (but shouldn't IMHO:

SELECT format('%L:1', '\:')::tsvector

My expectation here is that %L would transform '\:' into a correctly formatted character string, including single quotes around the string. The documentation reads:

L quotes the argument value as an SQL literal

SELECT $$'\:':1$$

returns «'\:':1», but

SELECT $$'\:':1$$::tsvector

returns «':':1», so something is happening here inside the single-quoted lexemes to the backslash. My understanding is that everything inside single quotes is taken as a lexeme. From the documentation:

To represent lexemes containing whitespace or punctuation, surround them with quotes

So having everything surrounded by single quotes (followed by a positional argument after the colon), «$$'\:':1$$::tsvector» should actually return a vector with a single lexeme «\:» at position 1.

Am I missing something?

Regards
  Johannes





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux