Does anyone know if SQL and PostgreSQL standards will be defined (10.x or higher) Parametric window size ?
MVE times of what I call the parametric window size:
WITH
D AS (SELECT T.x::FLOAT FROM generate_series(0., 10., 0.1) AS T(x)),
W AS (SELECT 10 AS WindowSize)
SELECT
D.x
,AVG(D.x) OVER (ROWS BETWEEN W.WindowSize PRECEDING AND CURRENT ROW)
FROM
D, W;
Which causes the following error:
ERROR: argument of ROWS must not contain variables
LINE 8: ,AVG(D.x) OVER (ROWS BETWEEN W.WindowSize PRECEDING AND C...
^
********** Error **********
ERROR: argument of ROWS must not contain variables
SQL State: 42P10
I understand that a parametric window is quite difficult to implement. And I know that I can get around some aspects of this limitation using Dynamic Query and PL / PGSQL.
My questions:
- Are SQL standards defining such a thing?
- Will PostgreSQL implement it (if so, when is it planned)?
- If not, what limitations should be overcome before using such a function?
source
share