Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emr15-0007Nz-E1 for pgsql-general@arkaria.postgresql.org; Sat, 17 Feb 2018 01:10:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emr13-0003cJ-MU for pgsql-general@arkaria.postgresql.org; Sat, 17 Feb 2018 01:10:13 +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.84_2) (envelope-from ) id 1emr13-0003bs-Bd for pgsql-general@lists.postgresql.org; Sat, 17 Feb 2018 01:10:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emr10-0007vz-Ro for pgsql-general@postgresql.org; Sat, 17 Feb 2018 01:10:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1H1A9Ew004350; Fri, 16 Feb 2018 20:10:09 -0500 From: Tom Lane To: Ken Tanzer cc: PG-General Mailing List Subject: Re: Any hope for more specific error message for "value too long..."? In-reply-to: References: Comments: In-reply-to Ken Tanzer message dated "Fri, 16 Feb 2018 16:30:06 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4348.1518829808.1@sss.pgh.pa.us> Date: Fri, 16 Feb 2018 20:10:09 -0500 Message-ID: <4349.1518829809@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ken Tanzer writes: > Hi. If you try to assign a too-long string to a field, Postgresql will say > so, but won't tell you which value/field is causing the problem: > CREATE TEMP TABLE foo (a VARCHAR(2)); > INSERT INTO foo VALUES ('ABC'); > CREATE TABLE > ERROR: value too long for type character varying(2) > That doesn't matter much in a simple example like that, but the example > below is currently making me wish PG was just a little bit more specific. > Is there much chance of this changing in future releases? It's an issue that's been on the radar screen for a long time, but it's not very clear how to improve matters without a lot of added overhead and/or an API break for user-defined data types, neither of which seem like prices we'd be willing to pay. For that matter, it's not totally clear what would constitute an improvement --- what do you wish it would show you, exactly? In the particular case here, the fact that a varchar length coercion is being invoked isn't even explicit in the query. Good ideas welcome ... regards, tom lane