varchar::bytea fails when varchar contains backslash

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: varchar::bytea fails when varchar contains backslash
Date: 2022-02-21 09:16:23
Message-ID: YhNYZ4qVmtjjxdti@c720-r368166
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello,

I wanted to look into a column of type varchar converting the content
with ::bytea to a hex string, but this fails when the column contains a
backslash:

psql -Usisis -dtestdb
psql (14.1)
Geben Sie »help« für Hilfe ein.

testdb=# select trenn from sik_fstab where name='EdvSelKenn';
trenn
-------------------------------
; :,(dot)-!(at)%&/()=?'*+#<>[\]{|}&"
; :,(dot)-!(at)%&/()=?'*+#<>[\]{|}&"
(2 Zeilen)

testdb=# select trenn::bytea from sik_fstab where name='EdvSelKenn';
ERROR: invalid input syntax for type bytea

Why is this?

matthias
--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Pospisek 2022-02-21 10:20:01 Re: Detecting schema changes via WAL logs
Previous Message Daevor The Devoted 2022-02-21 07:32:11 Re: 20220221-Clarification regarding PostgeSQL DB backup