>>I think four adjustments makes the initial syntax better:
>>- Allow usage of more than one input parameter. Maybe even zero would be 
>>allowed.

      ok

>> Instead of have special semantics for empty data source, declare the 
>> constant to be returned for it, say: 
>> create aggregate function my_count returning 0 for empty data source .... If 
>> this clause is omitted, null is returned for empty data source.

      This will limit functionality. What if you need to return something based 
on input parameters values?
      Not real sample but SELECT (SELECT CUSTOM_AGG(T2.A, T1.B, T1.C) FROM T2 
WHERE T2.X=T1.Y) FROM T1 
      And you need to return e.g. T1.B*T1.C if there is empty resultset.
      With declarative value this will be not possible.

>>- A clause to ignore null input values. If used, engine will filter out null 
>>input and not pass to the routine. This need to declare what.parameters 
>>shluld be considered

This will be over complicated. And have same problem as above.

>>- Instead of agg_finished, adjust SUSPEND (probably with another keyword) to 
>>somehing like: 
>>SUSPEND WHEN FETCHED DO <statement> WHEN FINISHED DO <statement>

This is only my humble opinion, but i do not like suspend concept here.
Engine know when provide values and when it need result from agg.
See my previous email (with „Agg_result_needed”) and criticize it if you see 
any problems there.

regards,
Karol Bieniaszewski

Od: Adriano dos Santos Fernandes
Wysłano: niedziela, 30 września 2018 04:52
Do: For discussion among Firebird Developers
Temat: Re: [Firebird-devel] User-defined aggregate functions

I think four adjustments makes the initial syntax better:
- Allow usage of more than one input parameter. Maybe even zero would be 
allowed.
- Instead of have special semantics for empty data source, declare the constant 
to be returned for it, say: create aggregate function my_count returning 0 for 
empty data source .... If this clause is omitted, null is returned for empty 
data source.
- A clause to ignore null input values. If used, engine will filter out null 
input and not pass to the routine. This need to declare what.parameters shluld 
be considered
- Instead of agg_finished, adjust SUSPEND (probably with another keyword) to 
somehing like: SUSPEND WHEN FETCHED DO <statement> WHEN FINISHED DO <statement>


Adriano

(Sorry to not be more detailed, I'm writing from smartphone)

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

Reply via email to