| From: | Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> |
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Cc: | Miguel Ferreira <miguelmbferreira(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Request for Implementation of Custom Error Messages for CHECK Constraints |
| Date: | 2025-05-11 13:38:27 |
| Message-ID: | CAB-JLwbM6FPanbpjynt5VLPbgD3+5fxKcLZOnvFSe5yrHHQmig@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Em sáb., 10 de mai. de 2025 às 21:57, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2025-05-11 13:54:02 | Re: Trivial comment fix for tsquerysend() |
| Previous Message | Álvaro Herrera | 2025-05-11 13:36:46 | Re: Valgrind - showing memory leaks |