>From c77ce40572b2079f3f107bd05c563331e000737a Mon Sep 17 00:00:00 2001
From: Maor Lipchuk <mlipchuk@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

