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

postgresql中的字符串文字和转义字符,第1张

概述尝试在表中插入转义字符会导致警告。 例如: 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 尝试在表中插入转义字符会导致警告。

例如:

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');
总结

以上是内存溢出为你收集整理的postgresql中的字符串文字和转义字符全部内容,希望文章能够帮你解决postgresql中的字符串文字和转义字符所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1172846.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存