How can I access the accumulator in SQL-like statement

I have an unexpected error in my query

SumAccum @currentSum;

//get vertex resultset and calculate accum
vertexSet = SELECT p
FROM vertex1:p-(edge1>:e)-vertex2:po
ACCUM p.@currentSum +=1;
//put name and calculated sum into temp table
SELECT, pSet.@currentSum INTO vertexNames
FROM vertexSet:pSet ;

But the second query shows an error
(10, 27) Error: An undefined variable pSet in current scope

//interesting, the next one works, when I put accum in WHERE
SELECT INTO vertexNames
FROM vertexSet:pSet
where pSet.@currentSum >=0 ;

And in documentation it is said that we can refer to the accumulators in sql-like syntax.
Thank you

You haven’t defined pSet in the first example.

Definition of pSet is the same in both examples:

FROM vertexSet:pSet

If I try to put accumulator pSet.@currentSum in select, then it throws an error. Otherwise everything is ok.

Oh I see - it is allowing it in the WHERE clause but not in the SELECT list - that seems very odd