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

From Alvaro Herrera
Subject Re: no partition pruning when partitioning using array type
Date
Msg-id 20180710180555.mcryjqgvlrmwuxj6@alvherre.pgsql
Whole thread Raw
In response to Re: no partition pruning when partitioning using array type  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: no partition pruning when partitioning using array type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2018-Jul-09, Tom Lane wrote:

> 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?

It scans the table to check whether any values violate that condition,
and raises an error if they do:

alvherre=# alter domain overint add check (value > 100);
ERROR:  column "a" of table "ppt1" contains values that violate the new constraint

This looks sensible behavior to me.

Now if you don't have any values that violate the new constraint, then
the constraint can be created just fine, and you now have a partition
that can never accept any values.  But that doesn't seem like a terrible
problem.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: _isnan() on Windows
Next
From: Alvaro Herrera
Date:
Subject: Re: no partition pruning when partitioning using array type