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