【bug - postgresql】PSQLException: ERROR: column reference “id“ is ambiguous


项目场景:

        Spring cloud + Mybatis-plus + postgresql



问题描述:

        关联查询报错

PSQLException: ERROR: column reference "id" is ambiguous


原因分析:

        关联查询时两个表均有id



解决方案:

        设置表别名 a,b 

若返回对象只需要取a的id select a.id  即可,如图.XXMapper.xml

【bug - postgresql】PSQLException: ERROR: column reference “id“ is ambiguous_第1张图片

同理

   PSQLException: ERROR: column reference "XX" is ambiguous 

你可能感兴趣的:(项目报错-bug,postgresql,数据库,database)