PSQLException: ERROR: syntax error at or near “user“

时间:2025-04-28 07:39:27

PSQLException: ERROR: syntax error at or near “user”

报错信息:

INSERT INTO biz_plan_internal_check_member (id, biz_plan_internal_check_id, user_category, user_ids, user) VALUES (343376491536449536, 343376491196710912, '实施', '1,2,3', '张三礼物王五');
2020-11-16 14:33:33 INFO  [biz-cdc-qc,,,] http-nio-8204-exec-9 p6spy 
2020-11-16 14:33:33 ERROR [biz-cdc-qc,,,] http-nio-8204-exec-9 com.cdrundle.core.handler.GlobalExceptionHandler 
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "user"
  位置:102
### The error may exist in com/cdrundle/cdc/qc/dao/BizPlanInternalCheckMemberDao.java (best guess)
### The error may involve com.cdrundle.cdc.qc.dao.BizPlanInternalCheckMemberDao.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO biz_plan_internal_check_member (id, biz_plan_internal_check_id, user_category, user_ids, user) VALUES (?, ?, ?, ?, ?)
### Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "user"

原因:user是关键字,在postgresql中不能使用关键字作为字段名称,修改字段名即可。