Re: How to get column, table or parameter name reporting when violating DOMAIN type constraint

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Valerio Battaglia <vabatta(at)gmail(dot)com>, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: How to get column, table or parameter name reporting when violating DOMAIN type constraint
Date: 2023-03-26 15:36:58
Message-ID: CAKFQuwa00CR2HPxmngsGqx0mGOc4j215gZ4j_v32OYO_gfpQYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sunday, March 26, 2023, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Sunday, March 26, 2023, Valerio Battaglia <vabatta(at)gmail(dot)com> wrote:
> >> Is there a way to obtain more detailed information about the column,
> table
> >> or parameter that is causing the constraint violation in this scenario?
> I
> >> would greatly appreciate any guidance or advice you could provide on
> this
> >> matter
>
> > What you see is what you get.
>
> More to the point, you have the wrong mental model: a domain constraint
> violation might not be associated with a table column at all.
>
>
I disagree that the mental model is wrong. Asking for better context when
constructing rows is a common request not only for domains but even simple
data types like dates or numbers. Sure, that added context is not always
applicable but when it is the lack of error detail does make life hard.
But it isn’t an easy problem to solve either.

There are existing threads that I may hunt later. IIRC, you (Tom) even
suggested a possible way forward on this last time it came up.

David J.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2023-03-26 16:00:05 Re: How to get column, table or parameter name reporting when violating DOMAIN type constraint
Previous Message Tom Lane 2023-03-26 15:26:23 Re: How to get column, table or parameter name reporting when violating DOMAIN type constraint