Hex escapes in strings only support ASCII range

From: Vilem Benjamin Liepelt <vileml(at)sqreamtech(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Hex escapes in strings only support ASCII range
Date: 2021-03-08 11:42:35
Message-ID: 23DABB3F-1A30-4F95-8741-DA62C132D54F@sqreamtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2021-03-08 12:40:04 Re: BUG #16915: use psql have error "could not change directory to "/root": Permission denied"
Previous Message Sandeep Thakkar 2021-03-08 06:41:30 Re: BUG #16910: I can't install postgresql