基于 htttps:htttps:// www。 postgresql.org/docs/current/sql-syntax-lexical.html#sql-syntax-snntax-snrings-escape ,我可以做到:
SELECT E'Test:\t\u00e1\u00e4\u00e9' as col;
-- Result (\t is interpreted tab character without problem, unicodes too):
col
-------------
Test: áäé
但是我想做些不同的事情,我无法解决它:
SELECT do_something_with_text(col)
FROM (SELECT 'Test:\t\u00e1\u00e4\u00e9' as col) as t;
do_something_with_text(text)函数在哪里解释逃脱的unicode和众所周知的代码,并返回与第一个结果完全相同的结果。
有可能以简单的方式吗?我不想用e''版本替换所有逃脱字符。
问候
Based on https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE , I can do it:
SELECT E'Test:\t\u00e1\u00e4\u00e9' as col;
-- Result (\t is interpreted tab character without problem, unicodes too):
col
-------------
Test: áäé
but I'd like to do something different and I can't solve it:
SELECT do_something_with_text(col)
FROM (SELECT 'Test:\t\u00e1\u00e4\u00e9' as col) as t;
where do_something_with_text(text) function will interpret escape Unicode and well-known codes and returns exactly the same result as first one.
Is it possible in easy way? I don't want to replace all escaping characters by E'' versions.
Regards
发布评论
评论(1)
在链接带有C风格的Escapes 的字符串常数您提供的:
这曾经是Postgres 9.1-中的默认行为。我会阅读注意以及其中的链接中的内容,以了解回归以前的行为的含义。
Per the Caution block at the link String Constants with C-Style Escapes you provided:
This used to be the default behavior in Postgres 9.1-. I would read the Caution and the contents of the links within in it to get a idea of what rolling back to previous behavior means.