-
+
SQL Syntax
identifiers A variant of quoted
identifiers allows including escaped Unicode characters identified
by their code points. This variant starts
- with U& (upper or lower case U followed by
+ with U& (upper or lower case U followed by
ampersand) immediately before the opening double quote, without
- any spaces in between, for example U&"foo".
+ any spaces in between, for example U&"foo".
(Note that this creates an ambiguity with the
- operator &. Use spaces around the operator to
+ operator &. Use spaces around the operator to
avoid this problem.) Inside the quotes, Unicode characters can be
specified in escaped form by writing a backslash followed by the
four-digit hexadecimal code point number or alternatively a
hexadecimal code point number. For example, the
identifier "data" could be written as
-U&"d\0061t\+000061"
+U&"d\0061t\+000061"
The following less trivial example writes the Russian
word slon
(elephant) in Cyrillic letters:
-U&"\0441\043B\043E\043D"
+U&"\0441\043B\043E\043D"
clause after the string, for example:
-U&"d!0061t!+000061" UESCAPE '!'
+U&"d!0061t!+000061" UESCAPE '!'
The escape character can be any single character other than a
hexadecimal digit, the plus sign, a single quote, a double quote,
PostgreSQL also supports another type
of escape syntax for strings that allows specifying arbitrary
Unicode characters by code point. A Unicode escape string
- constant starts with U& (upper or lower case
+ constant starts with U& (upper or lower case
letter U followed by ampersand) immediately before the opening
quote, without any spaces in between, for
- example U&'foo'. (Note that this creates an
- ambiguity with the operator &. Use spaces
+ example U&'foo'. (Note that this creates an
+ ambiguity with the operator &. Use spaces
around the operator to avoid this problem.) Inside the quotes,
Unicode characters can be specified in escaped form by writing a
backslash followed by the four-digit hexadecimal code point
followed by a six-digit hexadecimal code point number. For
example, the string 'data' could be written as
-U&'d\0061t\+000061'
+U&'d\0061t\+000061'
The following less trivial example writes the Russian
word slon
(elephant) in Cyrillic letters:
-U&'\0441\043B\043E\043D'
+U&'\0441\043B\043E\043D'
clause after the string, for example:
-U&'d!0061t!+000061' UESCAPE '!'
+U&'d!0061t!+000061' UESCAPE '!'
The escape character can be any single character other than a
hexadecimal digit, the plus sign, a single quote, a double quote,