cubicweb #1251252 subqueries and outer join can cause IndexError [validation pending]

The following RQL:

Any X,S,L WHERE X in_state S WITH X, L BEING (Any X,MAX(L) GROUPBY X WHERE X is RunExecution, T? wf_info_for X, T creation_date L)

can generate the following traceback:

2010-09-08 14:58:41 - (cubicweb.web) ERROR: IndexError('list index out of range',)
Traceback (most recent call last):
 File "/home/alf/cubicweb38/cubicweb/web/application.py", line 389, in main_publish
   result = controller.publish(rset=rset)
 File "/home/alf/cubicweb38/cubicweb/web/views/basecontrollers.py", line 126, in publish
   rset=rset, view=view)
 File "/home/alf/cubicweb38/cubicweb/cwvreg.py", line 378, in main_template
   res = obj.render(**kwargs)
 File "/home/alf/cubicweb38/cubicweb/view.py", line 173, in render
   view_func(**context)
 File "/home/alf/cubicweb38/cubicweb/web/views/basetemplates.py", line 140, in call
   view.render(w=w)
 File "/home/alf/cubicweb38/cubicweb/view.py", line 173, in render
   view_func(**context)
 File "/home/alf/cubicweb38/cubicweb/web/views/tableview.py", line 187, in call
   table.render(self.w)
 File "/home/alf/cubicweb38/cubicweb/web/htmlwidgets.py", line 50, in render
   self._render()
 File "/home/alf/cubicweb38/cubicweb/web/htmlwidgets.py", line 335, in _render
   for column, sortvalue in self.itercols(rowindex):
 File "/home/alf/cubicweb38/cubicweb/web/htmlwidgets.py", line 349, in itercols
   yield column, self.model.sortvalue(rowindex, column.rset_sortcol)
 File "/home/alf/cubicweb38/cubicweb/uilib.py", line 401, in newfunc
   ret = function(*args, **kwargs)
 File "/home/alf/cubicweb38/cubicweb/web/__init__.py", line 73, in newfunc
   value = function(*args, **kwargs)
 File "/home/alf/cubicweb38/cubicweb/uilib.py", line 392, in newfunc
   ret = function(*args, **kwargs)
 File "/home/alf/cubicweb38/cubicweb/web/views/tableview.py", line 274, in sortvalue
   entity, rtype = self.cw_rset.related_entity(row, col)
 File "/home/alf/cubicweb38/logilab/common/decorators.py", line 83, in cache_wrapper3
   _cache[args] = callableobj(self, *args)
 File "/home/alf/cubicweb38/cubicweb/rset.py", line 590, in related_entity
   col = rqlst.subquery_selection_index(select, col)
 File "/home/alf/cubicweb38/rql/stmts.py", line 336, in subquery_selection_index
   termvar = subselect.aliases[subq.aliases[col].name]
IndexError: list index out of range

This is very likely caused by the outer join.

prioritynormal
typebug
done in3.9.6
load left0.000
closed by<not specified>