有反斜杠时候,CakePHP往pgsql插入数据异常

原始数据:INSERT INTO “public”.”tables” (“table”, “columns”) VALUES (‘table1’, ‘{“col1″:false,”col2″:true,”col3″:false}’)
入库之后:INSERT INTO “public”.”tables” (“table”, “columns”) VALUES (‘table1’, ‘{“col1″$1,”col2″$2,”col3″$3}’)

数据特点:

  1.有个字段有反斜杠,而且实在最后一位;

  2. 有:xxx 这种格式数据会被转换掉

修改配置项:
set escape_string_warning=off;
可以解决问题。

参考: http://www.postgresql.org/docs/9.1/static/runtime-config-compatible.html

原文地址:https://www.cnblogs.com/uniqid/p/4150801.html