Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Support string constants with c-style escapes. Example:
select e'\u0061\x61\141' as col1;
col1
------
aaa
(1 row)
From PostgreSQL documentation 4.1.2.2. String Constants With C-Style Escapes:
An escape string constant is specified by writing the letter E (upper or lower case) just before the opening single quote, e.g., E'foo'. (When continuing an escape string constant across lines, write E only before the first opening quote.) Within an escape string, a backslash character () begins a C-like backslash escape sequence, in which the combination of backslash and following character(s) represent a special byte value, as shown in Table:
Backslash Escape Sequence | Interpretation |
---|---|
\b | backspace |
\f | form feed |
\n | newline |
\r | carriage return |
\t | tab |
\o, \oo, \ooo (o = 0–7) | octal byte value |
\xh, \xhh (h = 0–9, A–F) | hexadecimal byte value |
\uxxxx, \Uxxxxxxxx (x = 0–9, A–F) | 16 or 32-bit hexadecimal Unicode character value |
I suggest to not introduce any configuration flags for this feature because it seems like it does not contradict with any SQL dialect and it shouldn't slow down queries parsing.
Attachments
Issue Links
- is duplicated by
-
CALCITE-5560 Add support for escape strings in the format of E'foo\n'.
- Closed
- links to