Disallow SRFs when considering sorts below Gather Merge
Tomas Vondra <tomas.vondra@postgresql.org>
Disallow SRFs when considering sorts below Gather Merge While we do allow SRFs in ORDER BY, scan/join processing should not consider such cases - such sorts should only happen via final Sort atop a ProjectSet. So make sure we don't try adding such sorts below Gather Merge, just like we do for expressions that are volatile and/or not parallel safe. Backpatch to PostgreSQL 13, where this code was introduced as part of the Incremental Sort patch. Author: James Coleman Reviewed-by: Tomas Vondra Backpatch-through: 13 Discussion: https://postgr.es/m/CAAaqYe8cK3g5CfLC4w7bs=hC0mSksZC=H5M8LSchj5e5OxpTAg@mail.gmail.com Discussion: https://postgr.es/m/295524.1606246314%40sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/equivclass.c | modified | +7 −0 |
| src/backend/optimizer/util/tlist.c | modified | +0 −5 |
| src/include/optimizer/optimizer.h | modified | +5 −0 |
| src/test/regress/expected/incremental_sort.out | modified | +12 −0 |
| src/test/regress/sql/incremental_sort.sql | modified | +2 −0 |
Discussion
- Fix generate_useful_gather_paths for parallel unsafe pathkeys 8 messages · 2020-11-21 → 2020-12-22
- enable_incremental_sort changes query behavior 61 messages · 2020-09-26 → 2021-03-02