hi.
The attached patch allows CREATE OR REPLACE FUNCTION to correctly update domain
constraints when the function they depend on is changed.
so this thread[1] mentioned the problem can be resolved.
for example:
create function sqlcheck(int) returns bool as 'select $1 > 0' language sql;
create domain checkedint as int check(sqlcheck(value));
select 0::checkedint; -- fail
ERROR: value for domain checkedint violates check constraint "checkedint_check"
create or replace function sqlcheck(int) returns bool as 'select $1 <=
0' language sql;
select 1::checkedint; -- fail?
the last query won't fail on the master. with the patch it will fail.
I also make CREATE OR REPLACE FUNCTION validate each domain value when
the domain constraint conditions is associated the function we are
gonname changes
Of course, this will make CREATE OR REPLACE FUNCTION take way longer time
compared to the current.
Similar to domain constraints, attached patch also apply to table
check constraints too.
Is this what we want to do?
[1]: https://postgr.es/m/12539.1544107316%40sss.pgh.pa.us