From 0f1e5ecf5a11212e020a6677082be4d690cff82d Mon Sep 17 00:00:00 2001 From: "kedia,Akanksha" Date: Mon, 6 Nov 2023 13:39:12 +0530 Subject: [PATCH] SQL statements support simple literal, as well as Unicode usage Cherry-pick of https://github.com/trinodb/trino/pull/19628/commits/aacdb5e4acb082c2f49b116ceb0f47b0482f0a98 (trinodb/trino#19628) Co-authored-by: Will Morrison --- presto-docs/src/main/sphinx/language/types.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/presto-docs/src/main/sphinx/language/types.rst b/presto-docs/src/main/sphinx/language/types.rst index 704303d0a751..6eb8959d7dd6 100644 --- a/presto-docs/src/main/sphinx/language/types.rst +++ b/presto-docs/src/main/sphinx/language/types.rst @@ -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`` ^^^^^^^^