Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9j22-00020m-4w for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 22:27:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9j21-0000Rr-G0 for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 22:27:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9j20-0000Rk-Fr for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 22:27:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9j1t-0000Ci-PL for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 22:27:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s11MRBfg015801; Sat, 1 Feb 2014 17:27:11 -0500 From: Tom Lane To: Marco Atzeri cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8970: ts_parse incorrectly split numbers in digit token In-reply-to: <52ED5627.4070005@gmail.com> References: <20140125065024.26700.13481@wrigleys.postgresql.org> <20140126022535.GG10723@eldon.alvh.no-ip.org> <52E4C2F3.5020705@gmail.com> <3433.1390757236@sss.pgh.pa.us> <52ED5627.4070005@gmail.com> Comments: In-reply-to Marco Atzeri message dated "Sat, 01 Feb 2014 21:16:39 +0100" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <15783.1391293582.0@sss.pgh.pa.us> Date: Sat, 01 Feb 2014 17:27:11 -0500 Message-ID: <15800.1391293631@sss.pgh.pa.us> X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15783.1391293582.1@sss.pgh.pa.us> Marco Atzeri writes: > Eventually it was assumed that size of a wide char is always 32 bit ? Hm. It looks like there's an entirely unnecessary assumption that wchar_t and wint_t are the same width. Does the attached patch make things better for you? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="fix-wchar_t-width-assumption.patch"; charset="us-ascii" Content-ID: <15783.1391293582.2@sss.pgh.pa.us> Content-Description: fix-wchar_t-width-assumption.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparse= r_def.c index fa73dff..6728212 100644 *** a/src/backend/tsearch/wparser_def.c --- b/src/backend/tsearch/wparser_def.c *************** TParserCopyClose(TParser *prs) *** 432,438 **** * or give wrong result. * - multibyte encoding and C-locale often are used for * Asian languages. ! * - if locale is C the we use pgwstr instead of wstr */ =20=20 #ifdef USE_WIDE_UPPER_LOWER --- 432,438 ---- * or give wrong result. * - multibyte encoding and C-locale often are used for * Asian languages. ! * - if locale is C then we use pgwstr instead of wstr. */ =20=20 #ifdef USE_WIDE_UPPER_LOWER *************** p_is##type(TParser *prs) { \ *** 444,452 **** if ( prs->usewide ) \ { \ if ( prs->pgwstr ) \ ! return is##type( 0xff & *( prs->pgwstr + prs->state->poschar) );\ ! \ ! return isw##type( *(wint_t*)( prs->wstr + prs->state->poschar ) ); \ } \ \ return is##type( *(unsigned char*)( prs->str + prs->state->posbyte ) ); \ --- 444,456 ---- if ( prs->usewide ) \ { \ if ( prs->pgwstr ) \ ! { \ ! unsigned int c =3D *(prs->pgwstr + prs->state->poschar); \ ! if ( c > 0x7f ) \ ! return 0; \ ! return is##type( c ); \ ! } \ ! return isw##type( *( prs->wstr + prs->state->poschar ) ); \ } \ \ return is##type( *(unsigned char*)( prs->str + prs->state->posbyte ) ); \ *************** p_isalnum(TParser *prs) *** 475,484 **** if (c > 0x7f) return 1; =20=20 ! return isalnum(0xff & c); } =20=20 ! return iswalnum((wint_t) *(prs->wstr + prs->state->poschar)); } =20=20 return isalnum(*(unsigned char *) (prs->str + prs->state->posbyte)); --- 479,488 ---- if (c > 0x7f) return 1; =20=20 ! return isalnum(c); } =20=20 ! return iswalnum(*(prs->wstr + prs->state->poschar)); } =20=20 return isalnum(*(unsigned char *) (prs->str + prs->state->posbyte)); *************** p_isalpha(TParser *prs) *** 507,516 **** if (c > 0x7f) return 1; =20=20 ! return isalpha(0xff & c); } =20=20 ! return iswalpha((wint_t) *(prs->wstr + prs->state->poschar)); } =20=20 return isalpha(*(unsigned char *) (prs->str + prs->state->posbyte)); --- 511,520 ---- if (c > 0x7f) return 1; =20=20 ! return isalpha(c); } =20=20 ! return iswalpha(*(prs->wstr + prs->state->poschar)); } =20=20 return isalpha(*(unsigned char *) (prs->str + prs->state->posbyte)); ------- =_aaaaaaaaaa0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ------- =_aaaaaaaaaa0--