>>>>> "Hitoshi" == Hitoshi Harada <umi.tan...@gmail.com> writes:

 >>> (A question here: the spec allows (by my reading) the use of
 >>> parameters in the window frame clause, i.e. BETWEEN $1 PRECEDING
 >>> AND $2 FOLLOWING.  Wouldn't it therefore make more sense to treat
 >>> the values as Exprs, albeit very limited ones, and eval them at
 >>> startup rather than assuming we know the node type and digging
 >>> down into it all over the place?)

 >> Seems like you might as well allow any expression not containing
 >> local Vars.  Compare the handling of LIMIT.

 Hitoshi> Hmm, I've read it wrong, was assuming a constant for <unsigned value
 Hitoshi> specification> which actually includes any expression. But it's a
 Hitoshi> fixed value during execution, right? Otherwise, we cannot predicate
 Hitoshi> frame boundary.

The spec doesn't allow arbitrary expressions there, only literals and
parameters. Allowing more than that would be going beyond the spec, but
as with LIMIT, could be useful nonetheless.

For it to be a fixed value during execution, the same rules apply as
for LIMIT; it can't contain Vars of the current query level.

My thinking is that the executor definitely shouldn't be relying on it
being a specific node type, but should just ExecEvalExpr it on the
first call and store the result; then you don't have to know whether
it's a Const or Param node or a more complex expression.

-- 
Andrew.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to