Hello

The following shape still doesn't work properly with v5:

create type ct as (i int);
create function ct_mk(int) returns ct language sql as 'select row($1)::ct';
create table t2 (x int check ((ct_mk(x)).i > 0));
insert into t2 values (1);
create domain d as int constraint d_check check ((ct_mk(value)).i > 0);
comment on constraint d_check on domain d is 'bob comment';

s1: begin; select count(*) from t2;
s2: alter type ct alter attribute i type bigint; (waits for t2)
s3: alter domain d rename to d_old; create domain d as int;
s1: commit;

-- master: s2 fails
ERROR:  could not identify relation associated with constraint 16408

-- v5: s2 succeeds, and
select t.typname, c.conname, obj_description(c.oid,'pg_constraint')
  from pg_constraint c join pg_type t on t.oid = c.contypid;
 d       | d_check | bob comment
select (-1)::d_old;
 d_old
-------
    -1

> We may try to capture the domain oid above AlterDomainAddConstraint,
> while the old constraint still exists and re-add the constraint to that
> OID instead of resolving the name again.

That doesn't seem that complicated to me, and it would fix the above issue?


Reply via email to