Is it correct to raise an exception in a domain check - Mailing list pgsql-general

From Logan Grosz
Subject Is it correct to raise an exception in a domain check
Date
Msg-id CANn=KGi1fU3rkEbwnOZX3_WNQJXa39tbkmn7N4tAMSf75r7nNw@mail.gmail.com
Whole thread Raw
Responses Re: Is it correct to raise an exception in a domain check
List pgsql-general
Hi,

I have a `DOMAIN` on `JSONB`. I need to verify the shape of the JSON, so I have a check expression written in PL/pgSQL. The docs say

> Each constraint must be an expression producing a Boolean result

Would it be correct to raise an exception to indicate a failed check? I perform type-casts (that throw already) and other checks that would benefit from attaching a description to the client error.

Thank you,
Logan

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Feature request: Settings to disable comments and multiple statements in a connection
Next
From: Greg Sabino Mullane
Date:
Subject: Re: Feature request: Settings to disable comments and multiple statements in a connection