Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMyzt-0003PG-OG for pgsql-general@arkaria.postgresql.org; Wed, 23 Feb 2022 21:16:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nMyzM-0006Xb-I2 for pgsql-general@arkaria.postgresql.org; Wed, 23 Feb 2022 21:15:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMyzM-0006XS-2U for pgsql-general@lists.postgresql.org; Wed, 23 Feb 2022 21:15:56 +0000 Received: from mail-1.server.selfnet.de ([141.70.126.65]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMyzJ-000129-4u for pgsql-general@lists.postgresql.org; Wed, 23 Feb 2022 21:15:55 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3135642457 for ; Wed, 23 Feb 2022 22:15:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfnet.de; s=selfnet; t=1645650950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iGD/TDwmsvNi0LycadmnCHHGXsyCrEnqLDexFPqnz3I=; b=Nk1Y6FxkBTsVm4nYhGruUDsAfyFOiZZm7o/d7ywHNCl2k9vXitPItOSUhIKjecaBcf2bgj SjviqGC0N3Ppx6tteW7AlRmQzfyFticzUKXt2KqNqCrpgY9dlJtZc630q616LK3zVRGtvl DnFxy1tgYSE9HmQKxRZLpaJ3SgQ+nQg7GICj7NweEC+1Qq1722JVBw+HhNH70tjF2ON6Z9 S2GkHSw8WtV9lhFLXrW1JfxIV4x1RerdeNpYy/Ex2Zs1rZE0Jm02/kG4oep7jEg6Em4dxo 9WBDlbe3utwgG7s/5HqXv0oDfjbvlJoZ6/wSQ+qWALVN2fMPb1Zij7by96C8EQ== Message-ID: <9e1f312a-92cf-e002-9bfd-728aa450ee09@selfnet.de> Date: Wed, 23 Feb 2022 22:15:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 To: pgsql-general@lists.postgresql.org Content-Language: en-US From: =?UTF-8?Q?Johannes_Gra=c3=abn?= Subject: tsvector string representation and parsing Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: mail-1.server.selfnet.de; auth=pass smtp.auth=johannes smtp.mailfrom=johannes@selfnet.de List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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