8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 03:23:03 +01:00

Fixed CORE-2886 - Query with "NOT IN <subselect from view>" fails

This commit is contained in:
asfernandes 2010-02-27 18:22:04 +00:00
parent 0f72474f15
commit 1f121838c4

View File

@ -133,7 +133,7 @@ using namespace Firebird;
static UCHAR* alloc_map(thread_db*, CompilerScratch*, USHORT);
static jrd_nod* catenate_nodes(thread_db*, NodeStack&);
static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, jrd_nod* node);
static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node);
static jrd_nod* copy(thread_db*, CompilerScratch*, jrd_nod*, UCHAR *, USHORT, jrd_nod*, bool);
static void expand_view_nodes(thread_db*, CompilerScratch*, USHORT, NodeStack&, nod_t, bool);
static void ignore_dbkey(thread_db*, CompilerScratch*, RecordSelExpr*, const jrd_rel*);
@ -2641,7 +2641,7 @@ static jrd_nod* catenate_nodes(thread_db* tdbb, NodeStack& stack)
//
// Because the second form can use indexes.
// Returns NULL when not converted, and a new node to be processed when converted.
static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, jrd_nod* node)
static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node)
{
SET_TDBB(tdbb);
@ -2722,7 +2722,13 @@ static jrd_nod* convertNeqAllToNotAny(thread_db* tdbb, jrd_nod* node)
newInnerRse->rse_boolean = boolean;
return newNode;
UCHAR localMap[MAP_LENGTH];
// Initialize the map so all streams initially resolve to the original number. As soon copy
// creates new streams, the map are being overwritten.
for (unsigned i = 0; i < MAP_LENGTH; ++i)
localMap[i] = i;
return copy(tdbb, csb, newNode, localMap, 0, NULL, false);
}
@ -4122,7 +4128,7 @@ jrd_nod* CMP_pass1(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node)
case nod_ansi_all:
{
jrd_nod* newNode = convertNeqAllToNotAny(tdbb, node);
jrd_nod* newNode = convertNeqAllToNotAny(tdbb, csb, node);
if (newNode)
return CMP_pass1(tdbb, csb, newNode);