Program: 79984
Project: 79984
Buggy source:
/** 
 * Bind the driving left join select. Stuffs the left join SelectNode into the resultSet variable.
 */
private void bindLeftJoin(DataDictionary dd) throws StandardException {
  CompilerContext cc=getCompilerContext();
  final int previousReliability=cc.getReliability();
  try {
    cc.setReliability(previousReliability | CompilerContext.SQL_IN_ROUTINES_ILLEGAL);
    IgnoreFilter ignorePermissions=new IgnoreFilter();
    getCompilerContext().addPrivilegeFilter(ignorePermissions);
    _hojn=new HalfOuterJoinNode(_sourceTable,_targetTable,_searchCondition,null,false,null,getContextManager());
    _leftJoinFromList=_hojn.makeFromList(true,true);
    _leftJoinFromList.bindTables(dd,new FromList(getOptimizerFactory().doJoinOrderOptimization(),getContextManager()));
    if (!sourceIsBase_View_or_VTI()) {
      throw StandardException.newException(SQLState.LANG_SOURCE_NOT_BASE_VIEW_OR_VTI);
    }
    FromList topFromList=new FromList(getOptimizerFactory().doJoinOrderOptimization(),getContextManager());
    topFromList.addFromTable(_hojn);
    getCompilerContext().removePrivilegeFilter(ignorePermissions);
    for (    MatchingClauseNode mcn : _matchingClauses) {
      mcn.bindRefinement(this,_leftJoinFromList);
    }
    ResultColumnList selectList=buildSelectList();
    _selectList=selectList.copyListAndObjects();
    for (    MatchingClauseNode mcn : _matchingClauses) {
      mcn.bindThenColumns(_selectList);
    }
    resultSet=new SelectNode(selectList,topFromList,null,null,null,null,null,getContextManager());
    _leftJoinCursor=new CursorNode("String_Node_Str",resultSet,null,null,null,null,false,CursorNode.READ_ONLY,null,getContextManager());
    getCompilerContext().addPrivilegeFilter(ignorePermissions);
    _leftJoinCursor.bindStatement();
    getCompilerContext().removePrivilegeFilter(ignorePermissions);
    addOnClausePrivileges();
  }
  finally {
    cc.setReliability(previousReliability);
  }
}

Fixed version (ground truth):
/** 
 * Bind the driving left join select. Stuffs the left join SelectNode into the resultSet variable.
 */
private void bindLeftJoin(DataDictionary dd) throws StandardException {
  CompilerContext cc=getCompilerContext();
  final int previousReliability=cc.getReliability();
  try {
    cc.setReliability(previousReliability | CompilerContext.SQL_IN_ROUTINES_ILLEGAL);
    IgnoreFilter ignorePermissions=new IgnoreFilter();
    getCompilerContext().addPrivilegeFilter(ignorePermissions);
    _hojn=new HalfOuterJoinNode(_sourceTable,_targetTable,_searchCondition,null,false,null,getContextManager());
    _leftJoinFromList=_hojn.makeFromList(true,true);
    _leftJoinFromList.bindTables(dd,new FromList(getOptimizerFactory().doJoinOrderOptimization(),getContextManager()));
    if (!sourceIsBase_View_or_VTI()) {
      throw StandardException.newException(SQLState.LANG_SOURCE_NOT_BASE_VIEW_OR_VTI);
    }
    FromList topFromList=new FromList(getOptimizerFactory().doJoinOrderOptimization(),getContextManager());
    topFromList.addFromTable(_hojn);
    getCompilerContext().removePrivilegeFilter(ignorePermissions);
    for (    MatchingClauseNode mcn : _matchingClauses) {
      mcn.bindRefinement(this,_leftJoinFromList);
    }
    ResultColumnList selectList=buildSelectList();
    _selectList=selectList.copyListAndObjects();
    for (    MatchingClauseNode mcn : _matchingClauses) {
      mcn.bindThenColumns(_selectList);
    }
    resultSet=new SelectNode(selectList,topFromList,null,null,null,null,null,getContextManager());
    _leftJoinCursor=new CursorNode("String_Node_Str",resultSet,null,null,null,null,false,CursorNode.READ_ONLY,null,true,getContextManager());
    getCompilerContext().addPrivilegeFilter(ignorePermissions);
    _leftJoinCursor.bindStatement();
    getCompilerContext().removePrivilegeFilter(ignorePermissions);
    addOnClausePrivileges();
  }
  finally {
    cc.setReliability(previousReliability);
  }
}