Trivadis / plsql-cop-cli

db* CODECOP Command Line
Other
24 stars 1 forks source link

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

Closed PhilippSalvisberg closed 5 months ago

PhilippSalvisberg commented 5 months ago

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.

PhilippSalvisberg commented 5 months ago

closed via Azure DevOps commit