Hi all, We have encountered an issue when executing an insert command, when one of the values' length was bigger than the column size limitation.
the error message which been displayed was "value too long for type char..." but there was no indication which value has exceeded the limited size. (See bug #8880) Attached is a WIP patch which attend to make the message clearer. Regards, Maor and Daniel
>From c77ce40572b2079f3f107bd05c563331e000737a Mon Sep 17 00:00:00 2001 From: Maor Lipchuk <mlipc...@redhat.com> Date: Sun, 19 Jan 2014 18:13:52 +0200 Subject: [PATCH] varchar.c[WIP]: Add value to error message when size extends When trying to insert a value into to a column which has size limitation the error message being presented is "value too long for type char..." but there is no inication which value has exceeded the size. (See bug #8880) The proposed fix was to add the value the user tried to insert, so she can get a clue which value has been problematic. --- src/backend/utils/adt/varchar.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 502ca44..baf4d88 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -619,7 +619,7 @@ varchar(PG_FUNCTION_ARGS) if (s_data[i] != ' ') ereport(ERROR, (errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION), - errmsg("value too long for type character varying(%d)", + errmsg("value (%s) too long for type character varying(%d)", s_data, maxlen))); } -- 1.7.1
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers