From cfe717714c2a2dd96c3223086bda4b329812705c Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <ishii@postgresql.org>
Date: Sun, 23 Jan 2000 08:13:34 +0000
Subject: [PATCH] char_length()/octet_length for char() type now returns length
 of the charcter including trailing blanks.

---
 src/backend/utils/adt/varchar.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index c821a35a2df..e8cd0875502 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.56 2000/01/15 02:59:38 petere Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.57 2000/01/23 08:13:34 ishii Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -462,7 +462,7 @@ bpcharlen(char *arg)
 	if (!PointerIsValid(arg))
 		elog(ERROR, "Bad (null) char() external representation");
 #ifdef MULTIBYTE
-	l = bcTruelen(arg);
+	l = VARSIZE(arg) - VARHDRSZ;
 	len = 0;
 	s = VARDATA(arg);
 	while (l > 0)
@@ -474,7 +474,7 @@ bpcharlen(char *arg)
 	}
 	return (len);
 #else
-	return bcTruelen(arg);
+	return (VARSIZE(arg) - VARHDRSZ);
 #endif
 }
 
@@ -484,7 +484,7 @@ bpcharoctetlen(char *arg)
 	if (!PointerIsValid(arg))
 		elog(ERROR, "Bad (null) char() external representation");
 
-	return bcTruelen(arg);
+	return (VARSIZE(arg) - VARHDRSZ);
 }
 
 bool
-- 
GitLab