public inbox for [email protected]  
help / color / mirror / Atom feed
From: Logan Grosz <[email protected]>
To: [email protected]
Subject: Is it correct to raise an exception in a domain check
Date: Sun, 8 Jun 2025 22:01:47 -0600
Message-ID: <CANn=KGi1fU3rkEbwnOZX3_WNQJXa39tbkmn7N4tAMSf75r7nNw@mail.gmail.com> (raw)

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


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Is it correct to raise an exception in a domain check
  In-Reply-To: <CANn=KGi1fU3rkEbwnOZX3_WNQJXa39tbkmn7N4tAMSf75r7nNw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox