Re: Questionable coding in nth_value

2023-05-06 Thread Tatsuo Ishii
> On Sat, May 6, 2023 at 4:44 PM Tatsuo Ishii wrote: > >> Currently Window function nth_value is coded as following: >> >> nth = DatumGetInt32(WinGetFuncArgCurrent(winobj, 1, &isnull)); >> if (isnull) >> PG_RETURN_NULL(); >> const_offset = get_fn_expr_arg_s

Re: Questionable coding in nth_value

2023-05-06 Thread Richard Guo
On Sat, May 6, 2023 at 4:44 PM Tatsuo Ishii wrote: > Currently Window function nth_value is coded as following: > > nth = DatumGetInt32(WinGetFuncArgCurrent(winobj, 1, &isnull)); > if (isnull) > PG_RETURN_NULL(); > const_offset = get_fn_expr_arg_stable(fcin

Questionable coding in nth_value

2023-05-06 Thread Tatsuo Ishii
Currently Window function nth_value is coded as following: nth = DatumGetInt32(WinGetFuncArgCurrent(winobj, 1, &isnull)); if (isnull) PG_RETURN_NULL(); const_offset = get_fn_expr_arg_stable(fcinfo->flinfo, 1); if (nth <= 0) ereport(E