BUG #8880: no indication of value when exceeded maximum length

Lists: pgsql-bugs
From: mlipchuk(at)redhat(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8880: no indication of value when exceeded maximum length
Date: 2014-01-19 16:11:39
Message-ID: 20140119161139.26703.79206@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8880
Logged by: Maor Lipchuk
Email address: mlipchuk(at)redhat(dot)com
PostgreSQL version: 9.2.3
Operating system: Fedora 18
Description:

When trying to insert a varchar value in a limited column which exceed the
column limitation, we get an error of "value too long for type
character(%d)).
e.g varchar(5) --> value of 6 character "123456"

There is no indication which value exceeded the limitation and for big
tables it is almost impossible to indicate the specific exceeded value.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: mlipchuk(at)redhat(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8880: no indication of value when exceeded maximum length
Date: 2014-01-21 21:46:09
Message-ID: 20140121214609.GB29396@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Sun, Jan 19, 2014 at 04:11:39PM +0000, mlipchuk(at)redhat(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 8880
> Logged by: Maor Lipchuk
> Email address: mlipchuk(at)redhat(dot)com
> PostgreSQL version: 9.2.3
> Operating system: Fedora 18
> Description:
>
> When trying to insert a varchar value in a limited column which exceed the
> column limitation, we get an error of "value too long for type
> character(%d)).
> e.g varchar(5) --> value of 6 character "123456"
>
> There is no indication which value exceeded the limitation and for big
> tables it is almost impossible to indicate the specific exceeded value.

Yes, that is odd. If it was a constraint we would have printed out the
name of the constraint being violated, but type checking doesn't have
names and doesn't report which field is a problem. I am not sure what
to recommend here. I tried psql's \set VERBOSITY verbose, but that
didn't help:

test=> \set VERBOSITY verbose
test=> INSERT INTO test VALUES ('123456', '123456');
ERROR: 22001: value too long for type character varying(5)
LOCATION: varchar, varchar.c:623

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +