修复了关于rownum的4个bug。

1.最大值只有255,正常应该是无限大。
2.group by跟where rownum < n同时存在时,禁止将rownum优化成limit
3.groupy by后面没有rownum,而having后面有rownum时,会正常运行,正常应该报错。
4.union前后的子句如果有where rownum < n,并且还有含有order by的子查询时,禁止将order by优化删除掉。
This commit is contained in:
zhouxiongjia
2020-10-21 17:45:44 +08:00
parent 916c0cfbe0
commit dc80b79cc0
6 changed files with 89 additions and 3 deletions

View File

@ -979,7 +979,7 @@ static Datum ExecEvalRownum(RownumState* exprstate, ExprContext* econtext, bool*
*isDone = ExprSingleResult;
*isNull = false;
return Int8GetDatum(exprstate->ps->ps_rownum + 1);
return Int64GetDatum(exprstate->ps->ps_rownum + 1);
}
/* ----------------------------------------------------------------