Re: tsvector string representation and parsing

2022-02-24 Thread Tom Lane
=?UTF-8?Q?Johannes_Gra=c3=abn?= writes: > Before using format(), I tried just generating those strings by doubling > any single quote or backslash and enclosing the whole string in single > quotes, but that didn't seem a safe way, though it works in principle: That's the documented requirement,

Re: tsvector string representation and parsing

2022-02-23 Thread Johannes Graën
Thanks, Tom. On 23/02/2022 23.30, Tom Lane wrote: =?UTF-8?Q?Johannes_Gra=c3=abn?= writes: This is a minimal example that goes wrong (but shouldn't IMHO: SELECT format('%L:1', '\:')::tsvector format(%L) is designed to produce a SQL literal, which does not have the same requirements as a

Re: tsvector string representation and parsing

2022-02-23 Thread Tom Lane
=?UTF-8?Q?Johannes_Gra=c3=abn?= writes: > This is a minimal example that goes wrong (but shouldn't IMHO: >> SELECT format('%L:1', '\:')::tsvector format(%L) is designed to produce a SQL literal, which does not have the same requirements as a tsvector element ... yeah, they're close, but not clos

tsvector string representation and parsing

2022-02-23 Thread Johannes Graën
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',