pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vilem Benjamin Liepelt <vileml@sqreamtech.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Hex escapes in strings only support ASCII range
Date: Mon, 8 Mar 2021 12:42:35 +0100
Message-ID: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com> (raw)

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)

1: https://www.postgresql.org/docs/13/sql-syntax-lexical.html#id-1.5.3.5.9.5.3=

view thread (3+ messages)  latest in thread

Message-ID: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com>
Permalink:  ../23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com/
Also on:    postgresql.org/message-id/23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: vileml@sqreamtech.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Hex escapes in strings only support ASCII range
  In-Reply-To: <23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox