pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
AW: BUG #15373: null / utf-8
2+ messages / 1 participants
[nested] [flat]

Commits from this thread:
  2018-09-21 ed6755bae2 9b3477c9ba dabdc7e903 7f203d60f4 2f0c19ce4e 1927e431dd f77de4b0c0  docs:  remove use of escape strings and use bytea hex output
* AW: BUG #15373: null / utf-8
@ 2018-09-08 19:43  André Hänsel <andre@webkr.de>
  0 siblings, 1 reply; 2+ messages in thread

From: André Hänsel @ 2018-09-08 19:43 UTC (permalink / raw)
  To: 'Bruce Momjian' <bruce@momjian.us>; orchideric@yahoo.com; pgsql-bugs@lists.postgresql.org

Bruce Momjian wrote:
 
> On Sat, Sep  8, 2018 at 05:24:17PM +0000, PG Bug reporting form wrote:
>> doesn’t support converting NULL bytes to UTF-8 and therefore returns an
>> error

> You need to encode binary values containing nulls as bytea strings.

Actually this reminds me to log a documentation bug, or rather improvement.

It is already slightly confusing that Postgres doesn't support null bytes
in text columns at all and in bytea columns cannot take them in as a normal
string literal. I'm assuming this is traditional and difficult to change.

Now, there are two formats in which bytea column content can be specified,
the "hex" and the deprecated "escape" format. 

This "escape" format is called that way because it allows escape sequences
which are un-escaped before the data is written to the column. This step is
comparable to the parsing of JSON for jsonb columns or the parsing of array
syntax for any array type.

However, during the parsing of an SQL there is a second, completely
different, un-escaping step going on, the un-escaping of C-style escapes in
string literals starting with an "E", *if* you start the string literal
with an "E".

For some reason the example given in the documentation for the "hex"
format uses such an "escape string literal":

SELECT E'\\xDEADBEEF';

I found this very confusing. Can this example be changed to a normal
string literal, like this?

SELECT '\xDEADBEEF';

Regards, Andre





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* AW: BUG #15373: null / utf-8
@ 2018-09-14 08:15  André Hänsel <andre@webkr.de>
  parent: André Hänsel <andre@webkr.de>
  0 siblings, 0 replies; 2+ messages in thread

From: André Hänsel @ 2018-09-14 08:15 UTC (permalink / raw)
  To: 'Bruce Momjian' <bruce@momjian.us>; +Cc: orchideric@yahoo.com; pgsql-bugs@lists.postgresql.org

Bruce Momjian wrote: 
> I have developed the attached documentation patch to remove the E''
> syntax.  standard_conforming_strings defaulted to 'on' in PG 9.1.

On https://www.postgresql.org/docs/current/static/arrays.html, there
is a note at the bottom with an example currently using the C-style
escape syntax. Your patch changes that, as agreed, but then the text
of the note, as it is at the moment, doesn't make sense anymore
because the note is about the doubling of backslashes that you have
with C-style escape string literals.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-09-14 08:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-08 19:43 AW: BUG #15373: null / utf-8 André Hänsel <andre@webkr.de>
2018-09-14 08:15 ` André Hänsel <andre@webkr.de>

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