Rework code to determine partition pruning procedure

Enterprise / PostgreSQL - Alvaro Herrera [alvh.no-ip.org] - 19 April 2018 15:01 EDT

Amit Langote reported that partition prune was unable to work with arrays, enums, etc, which led him to research the appropriate way to match query clauses to partition keys: instead of searching for an exact match of the expression's type, it is better to rely on the fact that the expression qual has already been resolved to a specific operator, and that the partition key is linked to a specific operator family. With that info, it's possible to figure out the strategy and comparison function to use for the pruning clause in a manner that works reliably for pseudo-types also.

Include new test cases that demonstrate pruning where pseudotypes are involved.

Author: Amit Langote, Álvaro Herrera Discussion: https://postgr.es/m/2b02f1e9-9812-9c41-972d-517bdc0f815d@lab.ntt.co.jp

e5dcbb88a1 Rework code to determine partition pruning procedure
src/backend/partitioning/partprune.c | 110 ++++++++++----------
src/test/regress/expected/partition_prune.out | 138 ++++++++++++++++++++++++++
src/test/regress/sql/partition_prune.sql | 53 ++++++++++
3 files changed, 251 insertions(+), 50 deletions(-)

Upstream: git.postgresql.org


  • Share