> On 18/11/2011 05:38, Vlad Khorsun wrote:
>>> On 16-11-2011 22:39, Frank Ingermann wrote:
>>>> ...but it leads to an endless loop/recursion (using latest Fb3 beta)
>>>> :-(
>>>>
>>> Before decide what to do, I'd like to hear Vlad about the error
>>> isc_dsql_cte_wrong_clause, which, for example, happens if a recursive
>>> query has a GROUP BY.
>>>
>>> Why is it not allowed?
>>      Because standard prohibits any kind of aggregates in recursive CTE 
>> members.
>>
> Could you point me where is this described? I don't found it.

    Its hidded very well :) Seems i found it:

7.13 <query expression>

Syntax Rules
...
2) If <with clause> is specified, then:
...
    g) For a potentially recursive <with list> WL with n elements, and for i 
ranging from 1 (one) to n, let WLEi
        be the i-th <with list element> of WL, let WQNi be the <query name> 
immediately contained in WLEi,
        let WQEi be the <query expression> simply contained in WLEi, let WQTi 
be the table defined by WQEi,
        and let QNDG be the query name dependency graph of WL.
...
        iii) For each WLEi, for i ranging from 1 (one) to n, and for each WQNj 
that belongs to the stratum of WQEi:
...
            4) WQEi shall not contain a <query specification> QS such that:
...
                B) QS immediately contains a <select list> SL or TE immediately 
contains a <having clause>
                    HC and SL or TE contain a <set function specification>.

Where

6.9 <set function specification>

<set function specification> ::=
      <aggregate function>
    | <grouping operation>


Regards,
Vlad

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to