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 1rogKR-002lQM-Va for pgsql-sql@arkaria.postgresql.org; Mon, 25 Mar 2024 09:09:16 +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 1rogKQ-001O5m-JT for pgsql-sql@arkaria.postgresql.org; Mon, 25 Mar 2024 09:09:15 +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 1roVQ3-00Fgsz-1O for pgsql-sql@lists.postgresql.org; Sun, 24 Mar 2024 21:30:19 +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 1roVQ0-006I2L-J2 for pgsql-sql@lists.postgresql.org; Sun, 24 Mar 2024 21:30:18 +0000 X-Envelope-From: ftimmer@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 42OLUDth1531717 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sun, 24 Mar 2024 22:30:15 +0100 Message-ID: <627b2e786823e1a27c3ee982c381fab627c39ff6.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:29:39 +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