Re: Domain Constraint Violation Error Messages

From: Benjamin Coutu <ben(dot)coutu(at)zeyos(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Domain Constraint Violation Error Messages
Date: 2018-07-25 15:51:21
Message-ID: 20180725155145.BCBFB5FB09@mx.zeyos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> postgres[15271][1]=# \set VERBOSITY verbose
> postgres[15271][1]=# INSERT INTO myusers (name, email, token) VALUES('', 'b', 'x');
> ERROR: 23514: value for domain t_txt violates check constraint "dc_txt"
> SCHEMA NAME: public
> DATATYPE NAME: t_txt
> CONSTRAINT NAME: dc_txt
> LOCATION: ExecEvalConstraintCheck, execExprInterp.c:3521
> Time: 0.503 ms
>
> That seems to address most of your complaint? Unfortunately the column
> name is not available, as check constraints can involve more than one
> column.
>

Well, the problem is that the underlying column is not referenced, and neither is the table. That's the issue right there.

Also, I'm aware that regular table constraints can reference multiple columns. But it is my understanding that check constraint on domains may only always refer to one column (through VALUE), right? In any case it would be useful to at least display the underlying table name.

In general, I understand that it is not trivial given the generic/unified use of constraints whether it's column constraints, table constraints or domain constraints. I'm not giving up hope though, that the column info can be propagated at least for single column constraints and more importantly for domain constraints.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2018-07-25 15:59:16 Re: Domain Constraint Violation Error Messages
Previous Message Andres Freund 2018-07-25 15:41:29 Re: LLVM jit and matview