Em sáb., 10 de mai. de 2025 às 21:57, David G. Johnston <
david.g.johns...@gmail.com> escreveu:

> Constraints can be targeted by “comment on”.
>

So, why not using that COMMENT ON message to raise when that constraint
gets violated ?
A GUC like Constraint_Exception_Returns_MessageOn = {Never | Always |
If_Exists}
with its default value set to Never, so it runs like today, but if changed
to If_Exists it will try to
get that message or always, to show that COMMENT ON, even empty.

alter table b add constraint fk_b_a foreign key(ID) references a(ID);
comment on constraint fk_b_a on b is 'There is a problem on Foreign Key on
Table B related to Table A';

regards
Marcos

Reply via email to