v7.4.1 text_position() patch - Mailing list pgsql-patches

From Korea PostgreSQL Users' Group
Subject v7.4.1 text_position() patch
Date
Msg-id 000801c3e73d$e92fc870$cdcb56dc@paolo.net
Whole thread Raw
Responses Re: v7.4.1 text_position() patch
List pgsql-patches
In src/backend/utils/adt/varlena.c,
766 line must be exits in block of 'else if (elm >1)' too.

Because, strpos() function make a wrong result in multibyte string. 
line 796
------------
                ps1 = p1 = (pg_wchar *) palloc((len1 + 1) * sizeof(pg_wchar));
                (void) pg_mb2wchar_with_len((unsigned char *) VARDATA(t1), p1, len1);
                len1 = pg_wchar_strlen(p1);
                ps2 = p2 = (pg_wchar *) palloc((len2 + 1) * sizeof(pg_wchar));
                (void) pg_mb2wchar_with_len((unsigned char *) VARDATA(t2), p2, len2);
                len2 = pg_wchar_strlen(p2);

                /*** recalculate px ****/
                px = (len1 - len2);

                for (p = 0; p <= px; p++)


pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: support for printing/exporting xml
Next
From: Tom Lane
Date:
Subject: Re: v7.4.1 text_position() patch