加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql中的字符串文字和转义字符

发布时间:2020-12-13 16:53:27 所属栏目:百科 来源:网络整理
导读:尝试在表中插入转义字符会导致警告。 例如: create table EscapeTest (text varchar(50));insert into EscapeTest (text) values ('This is the first part n And this is the second'); 产生警告: WARNING: nonstandard use of escape in a string liter
尝试在表中插入转义字符会导致警告。

例如:

create table EscapeTest (text varchar(50));

insert into EscapeTest (text) values ('This is the first part n And this is the second');

产生警告:

WARNING:  nonstandard use of escape in a string literal

(使用PSQL 8.2)

任何人都知道如何解决这个问题?

部分。文本已插入,但仍会生成警告。

我发现了一个讨论,指出文本需要在“E”之前,因此:

insert into EscapeTest (text) values (E'This is the first part n And this is the second');

这抑制了警告,但文本仍未正确返回。当我添加额外的斜线作为迈克尔建议,它的工作。

因此:

insert into EscapeTest (text) values (E'This is the first part n And this is the second');

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读