cubicweb #3278573 Error in Union in RQL [validation pending]

We have the following case:

  • rql('(Any Y ORDERBY ST_DISTANCE(G1, G2) ASC LIMIT 10 WHERE X geometry G1, X eid 102004034 , Y geometry G2)') -> 10 elements;
  • rql('Any Z WHERE Z eid 102004034') -> 1 elements

But:

rql('(Any Y ORDERBY ST_DISTANCE(G1, G2) ASC LIMIT 10 WHERE X geometry G1, X eid 102004034 , Y geometry G2) UNION (Any Z WHERE Z eid 102004034)') -> 111211

The generated SQL is:

SELECT _Y.cw_eid
FROM cw_Location AS _X, cw_Location AS _Y
WHERE _X.cw_eid=102004034
ORDER BY ST_DISTANCE(_X.cw_geometry, _Y.cw_geometry))
UNION ALL
(SELECT 102004034)

Simple testcase:

(Any Y ORDERBY Y ASC LIMIT 10) UNION (Any Z WHERE Z eid 1)
priorityminor
typebug
done in3.19.0
load1.000
load left0.000
closed by<not specified>