Check constraint failure messages

From: Miles Elam <miles(dot)elam(at)productops(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Check constraint failure messages
Date: 2021-04-06 19:40:08
Message-ID: CAALojA9P+Ci-5ojrzDQZqpaJqL4XzKOB+DHRraME0cbSzM+7Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a domain that validates email addresses. When inserting a bunch of
entries I simply get the error message

ERROR: value for domain po.email violates check constraint "email_check"
SQL state: 23514

When inserting 1000+ entries in a batch, finding the exact entry with the
problem is noticeably harder than with other error types. For example when
a column should be a uuid but you pass in 'Mary had a little lamb', the
error message tells you what the invalid value is as well as the column
name you're trying to put it into.

Are there any quick hacks floating around out there to solve or at least
mitigate this?

- Miles

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2021-04-06 20:03:25 Re: Check constraint failure messages
Previous Message Jehan-Guillaume de Rorthais 2021-04-06 16:01:09 Re: MultiXactId wraparound and last aggressive vacuum time