06.01.2022 17:13, Adriano dos Santos Fernandes wrote:

See also:

https://github.com/FirebirdSQL/firebird/issues/1355

https://github.com/FirebirdSQL/firebird/commit/626ab18c426fd32d482e02093e72e57330596174


Worth testing GROUP BY <literal>, <field> ?

Since v3 we must be safe. Aggregate stream allocates impure space for
the expressions in its own region.

Correct, although I find it weird that the impure space is allocated dynamically rather than statically (in the request's impure area):

unsigned impureCount = m_group ? m_group->getCount() : 0;

if (!impure->groupValues && impureCount > 0)
{
impure->groupValues = FB_NEW_POOL(*tdbb->getDefaultPool()) impure_value[impureCount];
  memset(impure->groupValues, 0, sizeof(impure_value) * impureCount);
}

Why is it done this way? AFAIU, impureCount is known during the compile time, so the whole impure area could be preallocated during the prepare stage.

I'd say the flag exists because things were different before. Aggregate
were using expressions' impure regions.

Then FLAG_VALUE may be safely removed.


Dmitry


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to