From: Adriano d. S. F. <asf...@us...> - 2009-10-04 21:48:09
|
Build Version : V2.5.0.25674 Firebird 2.5 Release Candidate 1 (writeBuildNum.sh,v 1.25841 2009/10/04 21:47:55 asfernandes ) Update of /cvsroot/firebird/firebird2/src/dsql In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20956/src/dsql Modified Files: make.cpp pass1.cpp Log Message: Fixed CORE-2660 - COUNT(*) incorrectly returns 0 when a condition of an outer join doesn't match Index: make.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/dsql/make.cpp,v retrieving revision 1.188 retrieving revision 1.189 diff -b -U3 -r1.188 -r1.189 --- make.cpp 1 Aug 2009 05:37:08 -0000 1.188 +++ make.cpp 4 Oct 2009 21:47:52 -0000 1.189 @@ -432,7 +432,13 @@ case nod_map: map = (dsql_map*) node->nod_arg[e_map_map]; + context = (dsql_ctx*) node->nod_arg[e_map_context]; MAKE_desc(statement, desc, map->map_node, null_replacement); + + // ASF: We should mark nod_agg_count as nullable when it's in an outer join - CORE-2660. + if (context->ctx_flags & CTX_outer_join) + desc->dsc_flags |= DSC_nullable; + return; case nod_agg_min: Index: pass1.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/dsql/pass1.cpp,v retrieving revision 1.457 retrieving revision 1.458 diff -b -U3 -r1.457 -r1.458 --- pass1.cpp 7 Sep 2009 03:58:48 -0000 1.457 +++ pass1.cpp 4 Oct 2009 21:47:52 -0000 1.458 @@ -8028,6 +8028,12 @@ parent_context = FB_NEW(*tdbb->getDefaultPool()) dsql_ctx(*tdbb->getDefaultPool()); parent_context->ctx_context = statement->req_context_number++; parent_context->ctx_scope_level = statement->req_scope_level; + + // When we're in a outer-join part mark context for it. + if (statement->req_in_outer_join) + parent_context->ctx_flags |= CTX_outer_join; + parent_context->ctx_in_outer_join = statement->req_in_outer_join; + aggregate = MAKE_node(nod_aggregate, e_agg_count); aggregate->nod_arg[e_agg_context] = (dsql_nod*) parent_context; aggregate->nod_arg[e_agg_rse] = rse; |