Skip to content

Commit f7eeb32

Browse files
committed
Fix documentation of regular expression character-entry escapes.
The docs claimed that \uhhhh would be interpreted as a Unicode value regardless of the database encoding, but it's never been implemented that way: \uhhhh and \xhhhh actually mean exactly the same thing, namely the character that pg_mb2wchar translates to 0xhhhh. Moreover we were falsely dismissive of the usefulness of Unicode code points above FFFF. Fix that. It's been like this for ages, so back-patch to all supported branches.
1 parent 698c7a3 commit f7eeb32

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

doc/src/sgml/func.sgml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4148,7 +4148,7 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
41484148
<entry> <literal>\e</> </entry>
41494149
<entry> the character whose collating-sequence name
41504150
is <literal>ESC</>,
4151-
or failing that, the character with octal value 033 </entry>
4151+
or failing that, the character with octal value <literal>033</> </entry>
41524152
</row>
41534153

41544154
<row>
@@ -4174,15 +4174,17 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
41744174
<row>
41754175
<entry> <literal>\u</><replaceable>wxyz</> </entry>
41764176
<entry> (where <replaceable>wxyz</> is exactly four hexadecimal digits)
4177-
the UTF16 (Unicode, 16-bit) character <literal>U+</><replaceable>wxyz</>
4178-
in the local byte ordering </entry>
4177+
the character whose hexadecimal value is
4178+
<literal>0x</><replaceable>wxyz</>
4179+
</entry>
41794180
</row>
41804181

41814182
<row>
41824183
<entry> <literal>\U</><replaceable>stuvwxyz</> </entry>
41834184
<entry> (where <replaceable>stuvwxyz</> is exactly eight hexadecimal
41844185
digits)
4185-
reserved for a hypothetical Unicode extension to 32 bits
4186+
the character whose hexadecimal value is
4187+
<literal>0x</><replaceable>stuvwxyz</>
41864188
</entry>
41874189
</row>
41884190

@@ -4231,6 +4233,17 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
42314233
Octal digits are <literal>0</>-<literal>7</>.
42324234
</para>
42334235

4236+
<para>
4237+
Numeric character-entry escapes specifying values outside the ASCII range
4238+
(0-127) have meanings dependent on the database encoding. When the
4239+
encoding is UTF-8, escape values are equivalent to Unicode code points,
4240+
for example <literal>\u1234</> means the character <literal>U+1234</>.
4241+
For other multibyte encodings, character-entry escapes usually just
4242+
specify the concatenation of the byte values for the character. If the
4243+
escape value does not correspond to any legal character in the database
4244+
encoding, no error will be raised, but it will never match any data.
4245+
</para>
4246+
42344247
<para>
42354248
The character-entry escapes are always taken as ordinary characters.
42364249
For example, <literal>\135</> is <literal>]</> in ASCII, but

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy