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 1lJGA1-0005AN-Mz for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Mar 2021 13:43:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJGA0-00084F-3C for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Mar 2021 13:43:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJEHZ-0007iA-Dd for pgsql-bugs@lists.postgresql.org; Mon, 08 Mar 2021 11:42:41 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJEHW-0004sd-Ih for pgsql-bugs@lists.postgresql.org; Mon, 08 Mar 2021 11:42:39 +0000 Received: by mail-ed1-x52e.google.com with SMTP id bd6so14187365edb.10 for ; Mon, 08 Mar 2021 03:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sqreamtech-com.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:message-id:date:to; bh=qKSRzf6V7VOAz4+k5sP1YAHAnjcx59YbVBqDtIZt0dc=; b=Nel9ZVv2yRKI50KvAzUFS8d1XrbFGeosvCK2mYHAMrR37+L9BtpBiPkgvZnpf1ERFV 0QEgMx27u3NWuYWWUDJdZLh6ND/A6m8MUq6aMMshGs0HiE2XRYIB0NHg8PyXk90QCtyF uC3013zpTKfiOYqA8MNgqBTIfGQaZt0WtJ3H3lSPbHWTk+G+ZcmO6BwBUqdCPocmU5GL Kp9RdJsTZTTzGKJ1v3yEuLsuboJXDcmfeEeM4prd/WqznOlF2j6kBOrEND+8pTkoIOD/ +YtO3wSkpHDNKMVi1h7XZhGyBQNurtTqG783jjtyaG4MuMkOTEcOHaZ0qzJCpotjJx0Y 0csg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=qKSRzf6V7VOAz4+k5sP1YAHAnjcx59YbVBqDtIZt0dc=; b=Pbe97p72qNXKBmzWqwpWDKS3C5lXFQCIgdt5FhlZMbDOqYpE8bLsKu/+TQckEQIPNm 1GqzjRikX5gBfpIt01+8KzMVw09uz9LfqMeX9ScLbtuXMU6wQIOJstTICv+ZFGYgjnyw YXRfw+tT+uifEsRH5ZjOnguJ3Oue1fQpi01LMF65oUWFN98LjlQM7b4lmYLFme8BaJLN ZxC/4sUAxRwNaEKLW1Qr6UaHGAA/8Rb8lOETY6RgLxvfzof3Y3bACIAcWNyh+RmO9Rhv 3Zj1WpFQwopTmXqK47QdtmbVWoBZwi5yzAhLsqDtVhldgMM4OOkDqTqz39CgbHkwMLQc gVJg== X-Gm-Message-State: AOAM533jw7Gpc2Rds8f4n5Enq7viCnL1rVUAoQsyWlY1FwWUQDx9zdnj 6hYwGPJdMgKD33fV5T0B2oEBGV4KV2e44DoF X-Google-Smtp-Source: ABdhPJzQoZpCg6d5pqH8/46Vw1NFA0+q4uJuhmckg0xYJX87bDfhCh7VTLUa9rgKKG0Q+mSHhI+46g== X-Received: by 2002:aa7:d687:: with SMTP id d7mr21273007edr.118.1615203756856; Mon, 08 Mar 2021 03:42:36 -0800 (PST) Received: from [192.168.2.101] (p5b154017.dip0.t-ipconnect.de. [91.21.64.23]) by smtp.gmail.com with ESMTPSA id v11sm6860253eds.14.2021.03.08.03.42.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Mar 2021 03:42:36 -0800 (PST) From: Vilem Benjamin Liepelt Content-Type: multipart/alternative; boundary="Apple-Mail=_781A0D2D-7661-492E-AFB0-7719A3A0ECDB" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Hex escapes in strings only support ASCII range Message-Id: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com> Date: Mon, 8 Mar 2021 12:42:35 +0100 To: pgsql-bugs@lists.postgresql.org X-Mailer: Apple Mail (2.3654.60.0.2.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_781A0D2D-7661-492E-AFB0-7719A3A0ECDB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Escaped strings [1] fail on hex values greater than \x7f with a = factually incorrect error message: $ psql --command "select E'\x80';" ERROR: invalid byte sequence for encoding "UTF8": 0x80 $ psql --version psql (PostgreSQL) 13.1 I was able to reproduce this bug on psql 10. Workaround:=20 $ psql --command "select E'\u0080';" ?column?=20 ---------- \u0080 (1 row) 1: = https://www.postgresql.org/docs/13/sql-syntax-lexical.html#id-1.5.3.5.9.5.= 3= --Apple-Mail=_781A0D2D-7661-492E-AFB0-7719A3A0ECDB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Escaped strings [1] fail on hex values greater than \x7f with = a factually incorrect error message:

$ = psql --command "select E'\x80';"
ERROR:  invalid byte sequence for encoding "UTF8": = 0x80

$ psql --version
psql (PostgreSQL) 13.1

I was able to reproduce this bug on psql = 10.

Workaround: 

$ psql --command "select = E'\u0080';"
 ?column? 
----------
 \u0080
(1 row)

= --Apple-Mail=_781A0D2D-7661-492E-AFB0-7719A3A0ECDB--