Re: no partition pruning when partitioning using array type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: no partition pruning when partitioning using array type
Date
Msg-id 11760.1531173556@sss.pgh.pa.us
Whole thread Raw
In response to Re: no partition pruning when partitioning using array type  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: no partition pruning when partitioning using array type
Re: no partition pruning when partitioning using array type
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tracing it down, turns out that transformPartitionBoundValue gets from
> coerce_to_target_type a CoerceToDomain node.  It then tries to apply
> expression_planner() to simplify the expression, but that one doesn't
> want anything to do with a domain coercion (for apparently good reasons,
> given other comments in that file).

Quite.  Suppose you did

create domain overint as int;
create table pt (a overint) partition by range (a);
create table pt1 partition of pt for values from (0) to (100);

and the system took it, and then you did

alter domain overint add check (value > 100);

What happens now?

> However, if we take out the
> expression_planner() and replace it with a call to
> strip_implicit_coercions(), not only it magically starts working, but
> also the regression tests start failing with the attached diff, which
> seems a Good Thing to me.

Why would you find that to be a good thing?  The prohibition against
mutable coercions seems like something we need here, for more or less
the same reason in the domain example.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: no partition pruning when partitioning using array type
Next
From: Konstantin Knizhnik
Date:
Subject: Re: WAL prefetch