PostgreSQL: How escape '?

半腔热情 提交于 2021-02-17 06:53:05

问题


My original sql:

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

I read about E'' and tried this:

INSERT INTO clients (name) VALUES ('VsE'''emandon);

But this not working.

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


回答1:


Postgres follows the SQL standard.

Quote from the manual:

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


来源:https://stackoverflow.com/questions/26182711/postgresql-how-escape

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!