Trivadis / plsql-cop-cli

db* CODECOP Command Line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive for G-3183 when using table alias or table

PhilippSalvisberg opened this issue · comments

The following query reports a G-3183. In this case it would be possible to omit the dept reference.

select dept.dname, sum(emp.sal) as sal
  from dept
  join emp
    on emp.deptno = dept.deptno
 group by dept.dname;

However, in this case it's mandatory to use the table alias for deptno.

select d.deptno, d.dname, sum(e.sal) as sal
  from dept d
  join emp e
    on e.deptno = d.deptno
 group by d.deptno, d.dname;

So a qualified name should be allowed in the group by clause and not cause a G-3183.