4.1. Lexical Structure
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/sql-syntax-lexical.html
Description:
Why repeat information within the same section?
In Section 4.1.1, “Identifiers and Keywords”:
The option with identifiers in quotation marks allows you to include
escaped Unicode characters identified by their code points. This option
begins with U& (an uppercase or lowercase U followed by an ampersand)
immediately before the opening double quotation mark, with no spaces between
them, for example, U&“foo”. (Note that this creates ambiguity regarding the
& operator. To avoid this problem, use spaces around the operator.) Inside
the quotation marks, Unicode characters can be specified in escaped form by
writing a backslash followed by the character’s four-digit hexadecimal code,
or, alternatively, a backslash followed by a plus sign, followed by the
character’s six-digit hexadecimal code. For example, the identifier “data”
can be written as follows:
U&“d\0061t\+000061”
...
....
This information, along with examples, is also provided in Section 4.1.2.3.
String Constants with Escaped Unicode Characters
PostgreSQL also supports another type of string escape syntax that allows
you to specify arbitrary Unicode characters by code point. A Unicode-escaped
string constant begins with U& (an uppercase or lowercase U followed by an
ampersand) immediately before the opening quote, with no spaces between
them, for example, U&“foo”. (Note that this creates ambiguity with the &
operator. To avoid this problem, use spaces around the operator.) Inside the
quotes, Unicode characters can be specified in escaped form by writing a
backslash followed by the four-digit hexadecimal code of the character, or,
alternatively, a backslash followed by a plus sign, followed by the
six-digit hexadecimal code of the character. For example, the string “data”
can be written as follows:
U&'d\0061t\+000061'
...
....
On Thu, Aug 27, 2026 at 10:20 AM PG Doc comments form <
noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/sql-syntax-lexical.html
Description:Why repeat information within the same section?
4.1.1 and 4.1.2 are rightly written so as to keep them independent of one
another. It in part avoids wordiness in dealing with the fact that
identifiers use double quotes while string literals use single quotes.
In Section 4.1.1, “Identifiers and Keywords”:
U&“d\0061t\+000061”
This information, along with examples, is also provided in Section 4.1.2.3.
String Constants with Escaped Unicode CharactersU&'d\0061t\+000061'
Thus while these are indeed both similar to each other the so-called
repetition is warranted.
David J.
What should I look for?
postgres=# SELECT U&"d\0061t\+000061";
ERROR: column "data" does not exist
LINE 1: SELECT U&"d\0061t\+000061";
^
postgres=# SELECT U&"\0441\043B\043E\043D";
ERROR: column "слон" does not exist
LINE 1: SELECT U&"\0441\043B\043E\043D";
^
postgres=# SELECT U&"d!0061t!+000061" UESCAPE '!';
ERROR: column "data" does not exist
LINE 1: SELECT U&"d!0061t!+000061" UESCAPE '!';
чт, 27 авг. 2026 г. в 17:54, David G. Johnston <david.g.johnston@gmail.com>:
Show quoted text
On Thu, Aug 27, 2026 at 10:20 AM PG Doc comments form <
noreply@postgresql.org> wrote:The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/sql-syntax-lexical.html
Description:Why repeat information within the same section?
4.1.1 and 4.1.2 are rightly written so as to keep them independent of one
another. It in part avoids wordiness in dealing with the fact that
identifiers use double quotes while string literals use single quotes.In Section 4.1.1, “Identifiers and Keywords”:
U&“d\0061t\+000061”
This information, along with examples, is also provided in Section
4.1.2.3.
String Constants with Escaped Unicode CharactersU&'d\0061t\+000061'
Thus while these are indeed both similar to each other the so-called
repetition is warranted.David J.
On Friday, August 28, 2026, Yaroslav Saburov <y.saburov@gmail.com> wrote:
What should I look for?
postgres=# SELECT U&"d\0061t\+000061";
ERROR: column "data" does not exist
LINE 1: SELECT U&"d\0061t\+000061";
Identifiers are always looked up, string constants (written using the
single quote variant) get displayed as-is. You wrote the equivalent of:
select “data”; and your response is as expected since you have no from
clause to supply the table on which a column “data” could exist.
David J.