From b8f40ced2f7daebb13a3c9ab9aece5a969e2c28a Mon Sep 17 00:00:00 2001 From: Joe Conway Date: Sun, 30 Nov 2003 20:55:09 +0000 Subject: Make PQescapeBytea and byteaout consistent with each other, and octal escape all octets outside the range 0x20 to 0x7e. This fixes the problem pointed out by Sergey Yatskevich here: http://archives.postgresql.org/pgsql-bugs/2003-11/msg00140.php --- doc/src/sgml/datatype.sgml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index d47cee9633..7707aed2a4 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,5 +1,5 @@ @@ -1076,9 +1076,10 @@ SELECT b, char_length(b) FROM test2; strings are distinguished from characters strings by two characteristics: First, binary strings specifically allow storing octets of value zero and other non-printable - octets. Second, operations on binary strings process the actual - bytes, whereas the encoding and processing of character strings - depends on locale settings. + octets (defined as octets outside the range 32 to 126). + Second, operations on binary strings process the actual bytes, + whereas the encoding and processing of character strings depends + on locale settings. @@ -1131,14 +1132,25 @@ SELECT b, char_length(b) FROM test2; \\ + + 0 to 31 and 127 to 255 + non-printable octets + '\\xxx' (octal value) + SELECT '\\001'::bytea; + \001 + + - Note that the result in each of the examples in was exactly one - octet in length, even though the output representation of the zero - octet and backslash are more than one character. + The requirement to escape non-printable octets actually + varies depending on locale settings. In some instances you can get away + with leaving them unescaped. Note that the result in each of the examples + in was exactly one octet in + length, even though the output representation of the zero octet and + backslash are more than one character. @@ -1206,7 +1218,7 @@ SELECT b, char_length(b) FROM test2; 32 to 126 printable octets - ASCII representation + client character set representation SELECT '\\176'::bytea; ~ -- cgit v1.2.1