Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiM5Q-0000zA-Os for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Jul 2018 15:52:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiM5P-0003G9-HN for pgsql-bugs@arkaria.postgresql.org; Wed, 25 Jul 2018 15:52:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiM4s-0000ql-VS for pgsql-bugs@lists.postgresql.org; Wed, 25 Jul 2018 15:51:51 +0000 Received: from mx.zeyos.com ([88.99.153.70]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiM4p-0005Bs-QH for pgsql-bugs@lists.postgresql.org; Wed, 25 Jul 2018 15:51:49 +0000 Received: from mx.zeyos.com (localhost [127.0.0.1]) by mx.zeyos.com (Postfix) with ESMTP id BCBFB5FB09 for ; Wed, 25 Jul 2018 17:51:45 +0200 (CEST) Authentication-Results: mx.zeyos.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=zeyos.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zeyos.com; h= content-transfer-encoding:content-type:content-type:mime-version :to:from:from:subject:subject:date:date; s=dkim; t=1532533886; x=1533397887; bh=MA53t9I3K5+MilFdRH43titxUeHheBTeLoj4Xi3I8/k=; b= JzgwY28Bx0PfxUQzoypJeUlSyU20cTab1/4k+pctKerSz09RIFKBj80v3f3ISO/Q GgDAusAZKUap7I8aLZIVYGbfUd8jOsG/G3QO4BrBsMefH2HtzulwspIIw1s5/+We zXgUQF6vnbMiSciFw0lhGU/8fv4XiPEh6iRTFgKAxT4= X-Virus-Scanned: Debian amavisd-new at mx.zeyos.com Received: from mx.zeyos.com ([127.0.0.1]) by mx.zeyos.com (mx.zeyos.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id q-7FpEcXt4sV for ; Wed, 25 Jul 2018 17:51:26 +0200 (CEST) Received: from [81.171.8.203] (unknown [81.171.8.203]) by mx.zeyos.com (Postfix) with ESMTPSA id 58AF45FB0A; Wed, 25 Jul 2018 17:51:21 +0200 (CEST) Date: Wed, 25 Jul 2018 17:51:21 +0200 Subject: Re: Domain Constraint Violation Error Messages From: Benjamin Coutu To: Andres Freund Cc: pgsql-bugs@lists.postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20180725155145.BCBFB5FB09@mx.zeyos.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > postgres[15271][1]=3D# \set VERBOSITY verbose > postgres[15271][1]=3D# 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 >=20 > That seems to address most of your complaint? Unfortunately the column > name is not available, as check constraints can involve more than one > column. >=20 =0AWell, the problem is that the underlying column is not referenced, and n= either is the table. That's the issue right there.=0A=0AAlso, I'm aware tha= t regular table constraints can reference multiple columns. But it is my un= derstanding that check constraint on domains may only always refer to one c= olumn (through VALUE), right? In any case it would be useful to at least di= splay the underlying table name.=0A=0AIn general, I understand that it is n= ot trivial given the generic/unified use of constraints whether it's column= constraints, table constraints or domain constraints. I'm not giving up ho= pe though, that the column info can be propagated at least for single colum= n constraints and more importantly for domain constraints.