From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ken Tanzer <ken.tanzer@gmail.com>
Cc: PG-General Mailing List <pgsql-general@postgresql.org>
Subject: Re: Any hope for more specific error message for "value too long..."?
Date: Fri, 16 Feb 2018 20:10:09 -0500
Message-ID: <4349.1518829809@sss.pgh.pa.us> (raw)
In-Reply-To: <CAD3a31WR8X1TpjR_MoZxuz4S0BO3ZkPAeLoQ9rPxKHG=728eoQ@mail.gmail.com>
References: <CAD3a31WR8X1TpjR_MoZxuz4S0BO3ZkPAeLoQ9rPxKHG=728eoQ@mail.gmail.com>
Ken Tanzer <ken.tanzer@gmail.com> 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
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, ken.tanzer@gmail.com
Subject: Re: Any hope for more specific error message for "value too long..."?
In-Reply-To: <4349.1518829809@sss.pgh.pa.us>
References: <CAD3a31WR8X1TpjR_MoZxuz4S0BO3ZkPAeLoQ9rPxKHG=728eoQ@mail.gmail.com> <4349.1518829809@sss.pgh.pa.us>
* 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