From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-patches(at)postgresql(dot)org, lockhart(at)fourpalms(dot)org |
Subject: | Re: unknownin/out patch (was [HACKERS] PQescapeBytea is |
Date: | 2002-04-09 05:37:59 |
Message-ID: | 3CB27E37.9010704@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tatsuo Ishii wrote:
>>> Tatsuo Ishii wrote:
>>>
>>>>
>>>> Try a multibyte encoding database. For example,
>>>>
>>>> $ createdb -E EUC_JP test $ psql -c 'SELECT
>>>> SUBSTRING('1234567890' FROM 3)' test substring ----------- 3456
>>>>
>>>> (1 row)
>>>>
>>>> Apparently this is wrong. -- Tatsuo Ishii
>>>
>>> This problem exists in CVS tip *without* the unknownin/out
>>> patch:
>>
>> Sure. That has been broken for a while.
>
>
> I guess this actually happened in 1.79 of varlena.c:
>
Yes, I was just looking at that also. It doesn't consider the case of n
= -1 for MB. See the lines:
#ifdef MULTIBYTE
eml = pg_database_encoding_max_length ();
if (eml > 1)
{
sm = 0;
sn = (m + n) * eml + 3;
}
#endif
When n = -1 this does the wrong thing. And also a few lines later:
#ifdef MULTIBYTE
len = pg_mbstrlen_with_len (VARDATA (string), sn - 3);
I think both places need to test for n = -1. Do you agree?
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2002-04-09 05:57:47 | Re: unknownin/out patch (was [HACKERS] PQescapeBytea is |
Previous Message | Tatsuo Ishii | 2002-04-09 05:08:56 | Re: unknownin/out patch (was [HACKERS] PQescapeBytea is |
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2002-04-09 05:57:47 | Re: unknownin/out patch (was [HACKERS] PQescapeBytea is |
Previous Message | Tatsuo Ishii | 2002-04-09 05:08:56 | Re: unknownin/out patch (was [HACKERS] PQescapeBytea is |