Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> 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.
And what about those partition bound values? They are now illegal
for the domain, so I would expect a dump/reload to fail, regardless
of whether there are any values in the table.
regards, tom lane