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

Fixed CORE-5153 - Regression: Server crashes when aggregate functions are used together with NOT IN predicate.

This commit is contained in:
Adriano dos Santos Fernandes 2016-03-21 11:53:49 -03:00
parent be13a31bd7
commit f30733f8b6
6 changed files with 33 additions and 55 deletions

View File

@ -331,15 +331,11 @@ AggNode* AggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
dsc desc;
getDesc(tdbb, csb, &desc);
impureOffset = CMP_impure(csb, sizeof(impure_value_ex));
return this;
}
void AggNode::aggPostRse(thread_db* /*tdbb*/, CompilerScratch* csb)
{
impureOffset = CMP_impure(csb, sizeof(impure_value_ex));
}
void AggNode::aggInit(thread_db* tdbb, jrd_req* request) const
{
impure_value_ex* impure = request->getImpure<impure_value_ex>(impureOffset);
@ -611,15 +607,10 @@ AggNode* AvgAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
if (dialect1)
nodFlags |= FLAG_DOUBLE;
return this;
}
void AvgAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::aggPostRse(tdbb, csb);
// We need a second descriptor in the impure area for AVG.
tempImpure = CMP_impure(csb, sizeof(impure_value_ex));
return this;
}
string AvgAggNode::internalPrint(NodePrinter& printer) const
@ -1286,12 +1277,6 @@ void StdDevAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*
arg = PAR_parse_value(tdbb, csb);
}
void StdDevAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::aggPostRse(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(StdDevImpure));
}
void StdDevAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
{
desc->makeDouble();
@ -1311,6 +1296,15 @@ ValueExprNode* StdDevAggNode::copy(thread_db* tdbb, NodeCopier& copier) const
return node;
}
AggNode* StdDevAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(StdDevImpure));
return this;
}
string StdDevAggNode::internalPrint(NodePrinter& printer) const
{
AggNode::internalPrint(printer);
@ -1419,12 +1413,6 @@ void CorrAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*co
arg2 = PAR_parse_value(tdbb, csb);
}
void CorrAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::aggPostRse(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(CorrImpure));
}
void CorrAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
{
desc->makeDouble();
@ -1445,6 +1433,15 @@ ValueExprNode* CorrAggNode::copy(thread_db* tdbb, NodeCopier& copier) const
return node;
}
AggNode* CorrAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(CorrImpure));
return this;
}
string CorrAggNode::internalPrint(NodePrinter& printer) const
{
AggNode::internalPrint(printer);
@ -1601,12 +1598,6 @@ void RegrAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*co
arg2 = PAR_parse_value(tdbb, csb);
}
void RegrAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::aggPostRse(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(RegrImpure));
}
void RegrAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc)
{
desc->makeDouble();
@ -1627,6 +1618,15 @@ ValueExprNode* RegrAggNode::copy(thread_db* tdbb, NodeCopier& copier) const
return node;
}
AggNode* RegrAggNode::pass2(thread_db* tdbb, CompilerScratch* csb)
{
AggNode::pass2(tdbb, csb);
impure2Offset = CMP_impure(csb, sizeof(RegrImpure));
return this;
}
string RegrAggNode::internalPrint(NodePrinter& printer) const
{
AggNode::internalPrint(printer);

View File

@ -42,7 +42,6 @@ public:
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual AggNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
virtual void aggInit(thread_db* tdbb, jrd_req* request) const;
virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const;
@ -179,12 +178,11 @@ public:
virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count);
virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual AggNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual void aggInit(thread_db* tdbb, jrd_req* request) const;
virtual void aggPass(thread_db* tdbb, jrd_req* request, dsc* desc) const;
@ -220,12 +218,11 @@ public:
virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count);
virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual AggNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual void aggInit(thread_db* tdbb, jrd_req* request) const;
virtual bool aggPass(thread_db* tdbb, jrd_req* request) const;
@ -268,12 +265,11 @@ public:
virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count);
virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
virtual Firebird::string internalPrint(NodePrinter& printer) const;
virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc);
virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc);
virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const;
virtual AggNode* pass2(thread_db* tdbb, CompilerScratch* csb);
virtual void aggInit(thread_db* tdbb, jrd_req* request) const;
virtual bool aggPass(thread_db* tdbb, jrd_req* request) const;

View File

@ -979,9 +979,6 @@ public:
return NULL;
}
// Used to allocate aggregate impure inside the impure area of recursive CTEs.
virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
virtual void aggInit(thread_db* tdbb, jrd_req* request) const = 0; // pure, but defined
virtual void aggFinish(thread_db* tdbb, jrd_req* request) const;
virtual bool aggPass(thread_db* tdbb, jrd_req* request) const;

View File

@ -214,18 +214,6 @@ MapNode* MapNode::pass2(thread_db* tdbb, CompilerScratch* csb)
return this;
}
void MapNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb)
{
for (NestConst<ValueExprNode>* source = sourceList.begin();
source != sourceList.end();
++source)
{
AggNode* aggNode = (*source)->as<AggNode>();
if (aggNode)
aggNode->aggPostRse(tdbb, csb);
}
}
//--------------------

View File

@ -90,7 +90,6 @@ public:
MapNode* copy(thread_db* tdbb, NodeCopier& copier) const;
MapNode* pass1(thread_db* tdbb, CompilerScratch* csb);
MapNode* pass2(thread_db* tdbb, CompilerScratch* csb);
void aggPostRse(thread_db* tdbb, CompilerScratch* csb);
public:
virtual Firebird::string internalPrint(NodePrinter& printer) const

View File

@ -274,8 +274,6 @@ void AggregatedStream::init(thread_db* tdbb, CompilerScratch* csb)
fb_assert(m_map && m_next);
m_impure = CMP_impure(csb, sizeof(Impure));
m_map->aggPostRse(tdbb, csb);
// Separate nodes that requires the winPass call.
const NestConst<ValueExprNode>* const sourceEnd = m_map->sourceList.end();