前言
- 最近在使用pg和mysql时,遇到一些坑,记录一下。
关键字问题
- 例如from to 为mysql关键字,作为字段查询时,必须加引号
SELECT `from`,`to` FROM sc;(适用于mysql)
SELECT "from" ,"to" FROM sc;(适用于mysql和pg)
驼峰法命名的字段在pg问题
- creatTime被转成了creattime,看样子pg中全是小写
Caused by: org.postgresql.util.PSQLException: ERROR: column "creattime" does not exist
建议:Perhaps you meant to reference the column "t_bo_topo_count.creatTime".
pg中某字段使用了函数必须指定别名
- 在mybatis中返回值为map的时候,取值会出问题。