Prohibit pushing subqueries containing window function calculation to
authorAmit Kapila
Tue, 4 Sep 2018 05:19:05 +0000 (10:49 +0530)
committerAmit Kapila
Tue, 4 Sep 2018 05:19:05 +0000 (10:49 +0530)
commitbf61873ae3b64e2883c1a9c7af8e5df788a7123c
tree91305bf35c63a017136ec8c0c61526a1dc1477cc
parent3b7a96a619f78f80b4a470a0dcde4c92b5b7141f
Prohibit pushing subqueries containing window function calculation to
workers.

Allowing window function calculation in workers leads to inconsistent
results because if the input row ordering is not fully deterministic, the
output of window functions might vary across workers.  The fix is to treat
them as parallel-restricted.

In the passing, improve the coding pattern in max_parallel_hazard_walker
so that it has a chain of mutually-exclusive if ... else if ... else if
... else if ... IsA tests.

Reported-by: Marko Tiikkaja
Bug: 15324
Author: Amit Kapila
Reviewed-by: Tom Lane
Backpatch-through: 9.6
Discussion: https://postgr.es/m/CAL9smLAnfPJCDUUG4ckX2iznj53V7VSMsYefzZieN93YxTNOcw@mail.gmail.com
src/backend/optimizer/util/clauses.c
src/test/regress/expected/select_parallel.out
src/test/regress/sql/select_parallel.sql