Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgSQa-0003jG-Pc for pgsql-novice@arkaria.postgresql.org; Sun, 26 Mar 2023 15:37:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pgSQZ-0006lm-77 for pgsql-novice@arkaria.postgresql.org; Sun, 26 Mar 2023 15:37:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgSQY-0006lc-TD for pgsql-novice@lists.postgresql.org; Sun, 26 Mar 2023 15:37:02 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pgSQW-0004Ch-PF for pgsql-novice@lists.postgresql.org; Sun, 26 Mar 2023 15:37:01 +0000 Received: by mail-ed1-x52e.google.com with SMTP id r11so26125492edd.5 for ; Sun, 26 Mar 2023 08:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679845019; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dxIrAQozCgRAijwqraWulGTqbR7Ygc+OUd5sA03mFbs=; b=Ua9MgQj8bDR61bUgO4m6IItmVBHy9ZJcwqFelWAQtSFcEo1s+LYFmPES3oATZEVNiy 6d33R72C2CJNQS1eKb+oeVTdbQx4MMPlOe+ufmR7wTVrXGRPxjqzNwPlX6zM9kpYGe2c MsC7QJoV2Pstxvor/VSZu3AJgZHcMOzgffXMMQhmBUr1ClnKNmtN+OW1YcKlP3kok49T NN65Nx0TIvD6Djda4eiggQluYI6KGPmOsgPCOendGRZAFbFUvu+F6WVTEO03f/jZyvpJ oXd7QdTgaXRl8M9rBJZv/nE+H1dEYStmggAgPLv9YO8o6Agzvuo6auedShl07Gd3zkAD /FNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679845019; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dxIrAQozCgRAijwqraWulGTqbR7Ygc+OUd5sA03mFbs=; b=hBOIozaWpXLb9Qhgnd2fTtjz3xnH5gV+huKjIUXHzTh8rkBlP6G+sFH5vOFXOmDqiV UkTpoKSVOP9XvlGjee3YSsHKeI9r6ccTIHqhNXUeFJfDz374WYCA6jpqMw0S00DQvL4j rVhuKS4AjF5cdMtCdmZmqBHWv09WJH+B8OMVUclM3Fy9FhbIbLrO5iJsDoGrGiEbo2+m NTjmAvZd+l2DwGjQPQOTMMSNAzTZwULlEyRkbBSqnMu6wxjOOq93xG+uMfvuVbX0zJdA Soi3QRZQ+YTRHlDlUfIYsCHPv0Hc+NnSyOcLAQ1FAv34rSp7bEnRp0m4IoadcXd9Q6eR MxhA== X-Gm-Message-State: AAQBX9f6X8lY5+6lf08mhkGV0TgKr0nFNDvn1to38A3Wk7/dWIxVsLHL SbwM97kgwqzOcphWQD8k6H08pd09sAC6ig2ZaYo= X-Google-Smtp-Source: AKy350YWtz2Xor5rx4Z2hdGsqNzd1zwYQEb7Z5jOQRA+6+xFvFiNcJrBUBzmryyHXev7bhkIoyvvSiUfPOGiOA664vg= X-Received: by 2002:a17:906:ce59:b0:939:4c86:d493 with SMTP id se25-20020a170906ce5900b009394c86d493mr4432448ejb.13.1679845018974; Sun, 26 Mar 2023 08:36:58 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a98:ccd0:0:b0:1a0:6697:addf with HTTP; Sun, 26 Mar 2023 08:36:58 -0700 (PDT) In-Reply-To: <2911010.1679844383@sss.pgh.pa.us> References: <2911010.1679844383@sss.pgh.pa.us> From: "David G. Johnston" Date: Sun, 26 Mar 2023 08:36:58 -0700 Message-ID: Subject: Re: How to get column, table or parameter name reporting when violating DOMAIN type constraint To: Tom Lane Cc: Valerio Battaglia , "pgsql-novice@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000a23fc805f7cf6521" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a23fc805f7cf6521 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, March 26, 2023, Tom Lane wrote: > "David G. Johnston" writes: > > On Sunday, March 26, 2023, Valerio Battaglia 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=E2=80=99t 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. --000000000000a23fc805f7cf6521 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sunday, March 26, 2023, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"= David G. Johnston" <d= avid.g.johnston@gmail.com> writes:
> On Sunday, March 26, 2023, Valerio Battaglia <vabatta@gmail.com> wrote:
>> Is there a way to obtain more detailed information about the colum= n, table
>> or parameter that is causing the constraint violation in this scen= ario? 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.= =C2=A0 Asking for better context when constructing rows is a common request= not only for domains but even simple data types like dates or numbers.=C2= =A0 Sure, that added context is not always applicable but when it is the la= ck of error detail does make life hard.=C2=A0 But it isn=E2=80=99t an easy = problem to solve either.

There are existing thread= s that I may hunt later.=C2=A0 IIRC, you (Tom) even suggested a possible wa= y forward on this last time it came up.

David J. --000000000000a23fc805f7cf6521--