26.03.2014 10:44, Thomas Beckmann wrote: > > Please consider the following example: > > with recursive > CTE_CNT as (select 1 as I from RDB$DATABASE > union all select I + 1 from CTE_CNT where I < 20) > > select i.I, j.I, k.I from CTE_CNT i > left join CTE_CNT j on i.I = j.I and j.I<10 > join CTE_CNT k on j.I = k.I > > I would expect this to behave as > > select i.I, j.I, k.I from CTE_CNT i > left join (CTE_CNT j > join CTE_CNT k on j.I = k.I) on i.I = j.I and j.I<10 > > But it does not: It behaves like > > select i.I, j.I, k.I from CTE_CNT i > join CTE_CNT j on i.I = j.I and j.I<10 > join CTE_CNT k on j.I = k.I
In fact, this behaves as: select i.I, j.I, k.I from ( CTE_CNT i left join CTE_CNT j on i.I = j.I and j.I<10 ) join CTE_CNT k on j.I = k.I and this is not a bug. You should be writing: select i.I, j.I, k.I from CTE_CNT i left join CTE_CNT j on i.I = j.I and j.I<10 left join CTE_CNT k on j.I = k.I to keep the LEFT behaviour for all the streams depending on J. Dmitry ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel