pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Benjamin Coutu <ben.coutu@zeyos.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Domain Constraint Violation Error Messages
Date: Wed, 25 Jul 2018 17:51:21 +0200
Message-ID: <20180725155145.BCBFB5FB09@mx.zeyos.com> (raw)

> 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.




view thread (12+ messages)  latest in thread

Message-ID: <20180725155145.BCBFB5FB09@mx.zeyos.com>
Permalink:  ../20180725155145.BCBFB5FB09@mx.zeyos.com/
Also on:    postgresql.org/message-id/20180725155145.BCBFB5FB09@mx.zeyos.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ben.coutu@zeyos.com, andres@anarazel.de
  Subject: Re: Domain Constraint Violation Error Messages
  In-Reply-To: <20180725155145.BCBFB5FB09@mx.zeyos.com>
  References: <20180725155145.BCBFB5FB09@mx.zeyos.com>

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

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