PostgreSQL:如何逃脱'? [英] PostgreSQL: How escape '?

查看:63
本文介绍了PostgreSQL:如何逃脱'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的原始sql:

插入客户端(名称,电话)值("Vs'emandon","333026660");

我读到有关E的内容并尝试了此操作

I read about E'' and tried this:

INSERT INTO客户端(名称)VALUES('VsE'''emandon);

但这不起作用.

http://www.sqlfiddle.com/#!15/f717e/2

推荐答案

Postgres遵循SQL标准.

Postgres follows the SQL standard.

从手册中引用:

要在字符串常量中包含单引号字符,请写上两个相邻的单引号,例如'Dianne's horse'.请注意,这与双引号字符(")不相同.

To include a single-quote character within a string constant, write two adjacent single quotes, e.g., 'Dianne''s horse'. Note that this is not the same as a double-quote character (").

INSERT INTO clients (name, phone) VALUES ('Vs''emandon', '333026660');

这篇关于PostgreSQL:如何逃脱'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆