Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnh53-00ANMX-2p for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 17:54:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vnh52-00Cyil-0D for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 17:54:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnh51-00Cyid-2U for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 17:54:19 +0000 Received: from mail-yw1-x1135.google.com ([2607:f8b0:4864:20::1135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vnh4z-000000014Aw-0r5b for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 17:54:19 +0000 Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-79427f739b0so92177b3.3 for ; Wed, 04 Feb 2026 09:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770227655; x=1770832455; darn=lists.postgresql.org; h=in-reply-to:references:to:from:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lXmG/UF8qtsD+ePzu8ym6zORWBW8ABdYYKIqrntj8aI=; b=jK69eb9xpkMb8lb8+KI5B5HUwFWkXtmt1ofHrqliyjBJeFXuxmdfJi8RsISpk3E4Hn XjY8ihOPogM4EhyrzBtgZKtcNeH/C5pfmvc+gzgVCgT6gF2tP3UeoHaU8AEmeot4nASp fY8GpkU9nXNOeeQlXw1oWHAwUyzu5KoIBJQvOXGBAa6YF/2q1VcaKFPlmAvdkEPJElHQ ignFq6gvKjILHO7OyEt90Pe91uxTu6hxltEMPSQ12AjjqJ2ip9MdEcEXA2bOcwF8QiHb 42yNbGtjeBQfc6Mzxyp4nLW/YEppVmi8j08uhQgf9am1lBR56L+aSVzwaIkJMBRmcorB tOvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770227655; x=1770832455; h=in-reply-to:references:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lXmG/UF8qtsD+ePzu8ym6zORWBW8ABdYYKIqrntj8aI=; b=EvK0Kvg0l1z4GZhq5QPKwkyHGgIrYG9ck2L6AwGPrH79tsCMA/e4zg59RcKHoEiRe/ JF9ecUO3a6mR5RD/BTgu/r76cnoFqX7A581bTjF4pxr64bJQ5FrZfchvCrhdqvfY6mS9 wkaV8EplqeYLk5UTP4ZD/IB48H9KiakS8bTnR9CYryIIW96KzfXG2+f9t0K+jiLW4hG3 ddv6NQtvO29XYRsRJRa2yrrD9B4CONW4iSijb5KLM0/zh+jDcc7B9XJcjVRIq307WleU ZL4m+82eSUyVygFkuh8SPv+1u6eoGYThjb8ilzyBkL+H9Jqg3x1WpqVj8/pti47lZjJd CX7g== X-Forwarded-Encrypted: i=1; AJvYcCXqzsQ2BpwYIleHvJqd/EaIq6qt0sudZl6GRivdXjuhwEnR/wCkNhq3nXJzfbiwSkgnLOAwtUooIUoTbVYq@lists.postgresql.org X-Gm-Message-State: AOJu0YzAsnEOE3qRu9KdAl+D1qOba/FDhUZtZypl6tnq3p2bg2OFW8BM G6HDNdhOLH7RVlu0x3bmt2O5ZX3nXvE0/umJc400CrKgONxcYaFlpaTD X-Gm-Gg: AZuq6aIOZqT1b00NnFwLfrVeT5GBNz/56nuk/DlvQ84+TMj65n9SMxDOesy/+HGlJZ6 cghP0ZkDz8WU5acUGd4rDzmctGTPOQzPDof/USvA+xWPwzDqWlLeIeMdRLjx86JPJfUiprxaFmU ODHhBE1MOQvlvL3ZWVS4uh4Y/78couSOJri2C/MB0GfPR+qpksEoZNLdNhzdcVBJWCcKdKNXwWr djmE96qPg18kLIrOUu7TwC2AESEhzZu+Hv7Ix8veHaRw2rlA93VkNphbjyNo7m7cO7qMLjrVO3d mvmvFrxKJu/hpJzGCR5MKZeL/gEjdTLi9ZIIVEJq+lD1plvGFBVeMMoRVz2n7tM/ss5WMMNi3mm riEeCeXJ5XUB/ATptN4+ATJN3/mAUAR6tkI/k5FvvMBWRHX+OiJGhB0wnV6FNfYGJPYjVk3EfR0 iVftGCiJWi9DDu3FJ+rplstBXvzPYeCfTT4Q== X-Received: by 2002:a05:690c:62c7:b0:794:ef94:123c with SMTP id 00721157ae682-794fe75fbc6mr33057457b3.43.1770227654962; Wed, 04 Feb 2026 09:54:14 -0800 (PST) Received: from localhost ([2804:14d:328a:a59c:3d5c:bc8d:ee12:de75]) by smtp.gmail.com with ESMTPSA id 00721157ae682-794fee85606sm27121977b3.5.2026.02.04.09.54.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Feb 2026 09:54:14 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 04 Feb 2026 14:54:11 -0300 Message-Id: Subject: Re: Show expression of virtual columns in error messages From: "Matheus Alcantara" To: "Peter Eisentraut" , "Matheus Alcantara" , X-Mailer: aerc 0.21.0 References: <7c18e854-0ddb-4670-b0c4-f2541b5edd91@eisentraut.org> In-Reply-To: <7c18e854-0ddb-4670-b0c4-f2541b5edd91@eisentraut.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed Feb 4, 2026 at 11:57 AM -03, Peter Eisentraut wrote: > On 03.02.26 15:06, Matheus Alcantara wrote: >> The attached patch changes this behavior to show the virtual column >> expression instead: >>=20 >> ERROR: new row for relation "t" violates check constraint "t_c_check= " >> DETAIL: Failing row contains (5, 10, a * 2). > > Could be useful, but in this context you don't know which column is "a"? I agree but we at least show more information to the user. The user may still need to check the table definition to understand the constraint or to get the column ordering of the table to understand what the value of "a" is being used to compute the expression.=20 If the statement declare the columns that the values are referecing this could be easier to know (e.g INSERT INTO t(a, b) VALUES (5, 10)) but the user may still need to check the table definition to understand the constraint. I see this patch as a way to at least give more information to user about the error. Another possibility would be to get the actual values of "a" for example and show it on the error message, e.g: ERROR: new row for relation "t" violates check constraint "t_c_check" DETAIL: Failing row contains (5, 10, 5 * 2). -- Matheus Alcantara EDB: https://www.enterprisedb.com