From: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
---|---|
To: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | t-ishii(at)sra(dot)co(dot)jp, hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] fix for multi-byte partial truncating |
Date: | 1998-09-25 09:04:22 |
Message-ID: | 199809250904.SAA23096@srapc451.sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>Applied, but for some reason patch did not like the normal cvs/rcs diff
>format. Not sure why. Please check to see it is OK. Looks OK here.
Thank you, Bruce. Everything seems OK too.
But I found a mistake with my patches. bpchar does not pad blanks
anymore! Could you apply following patches to
backend/utils/adt/varchar.c? (the diff is against the current source
tree)
*** varchar.c.orig Fri Sep 25 15:12:34 1998
--- varchar.c Fri Sep 25 17:59:47 1998
***************
*** 147,160 ****
if ((len == -1) || (len == VARSIZE(s)))
return s;
- #ifdef MULTIBYTE
- /* truncate multi-byte string in a way not to break
- multi-byte boundary */
- rlen = pg_mbcliplen(VARDATA(s), len - VARHDRSZ, len - VARHDRSZ);
- len = rlen + VARHDRSZ;
- #else
rlen = len - VARHDRSZ;
- #endif
if (rlen > 4096)
elog(ERROR, "bpchar: length of char() must be less than 4096");
--- 147,153 ----
***************
*** 167,173 ****
--- 160,172 ----
result = (char *) palloc(len);
VARSIZE(result) = len;
r = VARDATA(result);
+ #ifdef MULTIBYTE
+ /* truncate multi-byte string in a way not to break
+ multi-byte boundary */
+ slen = pg_mbcliplen(VARDATA(s), rlen, rlen);
+ #else
slen = VARSIZE(s) - VARHDRSZ;
+ #endif
s = VARDATA(s);
#ifdef STRINGDEBUG
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 1998-09-25 09:33:04 | Re: [HACKERS] crash on new system views |
Previous Message | Jan Wieck | 1998-09-25 07:12:02 | PL/pgSQL Makefile (was: Re: [HACKERS] SQL Triggers) |