File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
main/java/com/trivadis/tvdcc/validators
test/java/com/trivadis/tvdcc/validators/tests Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ class Hint extends PLSQLValidator implements PLSQLCopValidator {
256256 def private dispatch getTableReference (MergeStatement stmt ) {
257257 val result = new ArrayList<Pair<String , String > >
258258 result. add(new Pair (stmt. intoClause? . table? . value, stmt. intoClause? . alias? . value))
259+ result. add(new Pair (stmt. usingClause? . table? . value, stmt. usingClause? . alias? . value))
259260 return result
260261 }
261262
Original file line number Diff line number Diff line change @@ -430,5 +430,29 @@ class HintTest extends AbstractValidatorTest {
430430 val issues = stmt. issues
431431 Assert . assertEquals(0 , issues. size)
432432 }
433+
434+ // -- issue 44 https://github.com/Trivadis/plsql-cop-validators/issues/44
435+
436+ @Test
437+ def void falsePositiveForHintsReferringTableAliasInUsingClauseOfMerge () {
438+ val stmt = ' ' '
439+ merge /*+ use_hash (d s) */ into bonuses d
440+ using (select employee_id, salary, department_id
441+ from employees
442+ where department_id = 80) s
443+ on (d.employee_id = s.employee_id)
444+ when matched then
445+ update
446+ set d.bonus = d.bonus + s.salary *.01
447+ delete
448+ where (s.salary > 8000)
449+ when not matched then
450+ insert (d.employee_id, d.bonus)
451+ values (s.employee_id, s.salary *.01)
452+ where (s.salary <= 8000);
453+ ' ' '
454+ val issues = stmt. issues
455+ Assert . assertEquals(0 , issues. size)
456+ }
433457
434458}
You can’t perform that action at this time.
0 commit comments