Skip to content

Commit

Permalink
SQL statements support simple literal, as well as Unicode usage
Browse files Browse the repository at this point in the history
Cherry-pick of trinodb/trino@aacdb5e (trinodb/trino#19628)

Co-authored-by: Will Morrison <[email protected]>
  • Loading branch information
Akanksha-kedia and Will Morrison committed Nov 8, 2023
1 parent f0bd6a5 commit 0f1e5ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion presto-docs/src/main/sphinx/language/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,20 @@ String

Variable length character data with an optional maximum length.

Example type definitions: ``varchar``, ``varchar(20)``
Example type definitions: ``varchar``, ``varchar(20)``.

SQL supports simple and Unicode string literals:
- Literal string : ``'Hello winter !'``
- Unicode string with default escape character: ``U&'Hello winter \2603 !'``
- Unicode string with custom escape character: ``U&'Hello winter #2603 !' UESCAPE '#'``

A Unicode string is prefixed with ``U&`` and requires an escape character
before any Unicode character usage with 4 digits. In these examples
``\2603`` and ``#2603`` represent a snowman character. Long Unicode codes
with 6 digits require a plus symbol ``+`` before the code. For example,
use ``\+01F600`` for a grinning face emoji.

Single quotes in string literals can be escaped by using another single quote: ``'It''s a beautiful day!'``

``CHAR``
^^^^^^^^
Expand Down

0 comments on commit 0f1e5ec

Please sign in to comment.