Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roVRS-001sXp-Uf for pgsql-sql@arkaria.postgresql.org; Sun, 24 Mar 2024 21:31:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1roVRR-00Fh5j-GF for pgsql-sql@arkaria.postgresql.org; Sun, 24 Mar 2024 21:31:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roVRR-00Fh5b-7k for pgsql-sql@lists.postgresql.org; Sun, 24 Mar 2024 21:31:45 +0000 Received: from einhorn.in-berlin.de ([192.109.42.8] helo=einhorn-mail-out.in-berlin.de) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roVRP-006I2Y-F9 for pgsql-sql@lists.postgresql.org; Sun, 24 Mar 2024 21:31:45 +0000 X-Envelope-From: ml@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 42OLVgQ61533037 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sun, 24 Mar 2024 22:31:43 +0100 Message-ID: <0afcf065cd34cc84655864da20e3589e634b83c0.camel@ft-c.de> Subject: decode/encode backslash to base64 From: ft Reply-To: ml@ft-c.de To: pgsql-sql@lists.postgresql.org Date: Sun, 24 Mar 2024 22:31:08 +0100 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 FreeBSD GNOME Team MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello,=20 here is an example for decode and encode=20 a string with backslash: 'a\' select trim(convert_from(decode('YVw=3D', 'base64'), 'UTF8') )::text;=20 answer: 'a\' the next query throw an error:=C2=A0 SQL Error [22P02]: ERROR: invalid input syntax for type bytea select encode(trim(convert_from(decode('YVw=3D', 'base64'), 'UTF8') )::text::bytea, 'base64' ); also: select encode('a\'::text::bytea, 'base64'); What should I do? Franz