近日工做碰到一个PG error missing FROM-clause entry for table "t",这个错误基本上出如今选择列或者where语句后面引用了t2的表可是在from 后面并无对应的表名。测试以下:sql
select t.* from dual;
select * from dual where t.id = ?
这类错误很好查清,找到对应的t,看下对应有没有表别名,若是没有,则加上,以下:测试
select t.* from dual t; select * from dual t where t.id = ?;