Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9gzh-0006nS-SW for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 20:16:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9gzh-0001Gd-CG for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Feb 2014 20:16:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9gzg-0001GX-OE for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 20:16:48 +0000 Received: from mail-ea0-x22a.google.com ([2a00:1450:4013:c01::22a]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9gze-0006OQ-0f for pgsql-bugs@postgresql.org; Sat, 01 Feb 2014 20:16:48 +0000 Received: by mail-ea0-f170.google.com with SMTP id k10so2982737eaj.15 for ; Sat, 01 Feb 2014 12:16:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=inU+MhiyM9WIItnjzjYXNpDGItvYSuOZUlQdzPxRZzA=; b=p/ZqmwRlxcwk5fNcdqm1wIOAljEmowz8IKAh+ybL5xmfOYEcuypBlo2fcVjmaHkxGW l1bfgacL0UTvsjb5k61+GEQbYF+93mMIf2FtmF8Kb6B2iZ2KCcy/OAH+up2G30OCBKmd HG7tR7x4JfpFiovw1ML+qODG1NR1Xckc1Jv9ItnZdZ7pclc3NeCAETtiSsgRo92bSqCk 7MM9MM5nST9fO95LERhqDkJGNf2HlOXYEnvqJJxA4RgG6ms2FlZZ8FceSqIMSAiY8e4y 74meam4Wdt04xeT3KAg8Q++qFntiFClZ32CkMeAzdOWweW+9WM98Y1VYpnK5NL2Uawmp euVA== X-Received: by 10.15.102.78 with SMTP id bq54mr976264eeb.94.1391285804313; Sat, 01 Feb 2014 12:16:44 -0800 (PST) Received: from [192.168.2.112] (p5B17402E.dip0.t-ipconnect.de. [91.23.64.46]) by mx.google.com with ESMTPSA id d9sm26980817eei.9.2014.02.01.12.16.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Feb 2014 12:16:43 -0800 (PST) Message-ID: <52ED5627.4070005@gmail.com> Date: Sat, 01 Feb 2014 21:16:39 +0100 From: Marco Atzeri User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #8970: ts_parse incorrectly split numbers in digit token References: <20140125065024.26700.13481@wrigleys.postgresql.org> <20140126022535.GG10723@eldon.alvh.no-ip.org> <52E4C2F3.5020705@gmail.com> <3433.1390757236@sss.pgh.pa.us> In-Reply-To: <3433.1390757236@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) 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 On 26/01/2014 18:27, Tom Lane wrote: > Marco Atzeri writes: >> On 26/01/2014 03:25, Alvaro Herrera wrote: >>> To trace this, I would look at src/backend/tsearch/wparser_def.c; >>> probably try compiling that file with WPARSER_TRACE defined, and compare >>> the output of ts_parse() in something simple such as '345' in a working >>> port with the failing one. That might give you clues as to what is >>> causing the failure. > >> [ trace ] > > As was suspected upthread, this shows that p_isdigit() is failing to > recognize "3" as a digit. So you've got broken locale support somewhere. > > There are two different implementations of p_isdigit in wparser_def.c, > depending on whether USE_WIDE_UPPER_LOWER is defined. It should be, in > a Windows build, but maybe this is tracing back to a configure problem? > > regards, tom lane > debugging a bit I think that is not a broken locale the first two times the character contains also a portion of the next digit so the result is always false. Eventually it was assumed that size of a wide char is always 32 bit ? "Unlike Windows UTF-16 2-byte wide chars, wchar_t on Linux and OS X is 4 bytes UTF-32 (gcc/g++ and XCode). On cygwin it is 2 (cygwin uses Windows APIs)." testing with "SELECT * FROM ts_parse('default', '345');" -------------------------------------------------------------- Breakpoint 1, p_isdigit (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:560 560 p_iswhat(digit) (gdb) step 0x007036d8 in iswdigit () (gdb) step Single stepping until exit from function iswdigit, which has no line number information. iswdigit (c=3407923) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 35 return (c >= (wint_t)'0' && c <= (wint_t)'9'); (gdb) p/x c $77 = 0x340033 (gdb) finish Run till exit from #0 iswdigit (c=3407923) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 0x0060c510 in TParserGet (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:1834 1834 if (item->isclass(prs) != 0) Value returned is $78 = 0 Breakpoint 1, p_isdigit (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:560 560 p_iswhat(digit) (gdb) step 0x007036d8 in iswdigit () (gdb) step Single stepping until exit from function iswdigit, which has no line number information. iswdigit (c=3473460) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 35 return (c >= (wint_t)'0' && c <= (wint_t)'9'); (gdb) p/x c $79 = 0x350034 (gdb) finish Run till exit from #0 iswdigit (c=3473460) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 0x0060c510 in TParserGet (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:1834 1834 if (item->isclass(prs) != 0) Value returned is $80 = 0 Breakpoint 1, p_isdigit (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:560 560 p_iswhat(digit) (gdb) step 0x007036d8 in iswdigit () (gdb) step Single stepping until exit from function iswdigit, which has no line number information. iswdigit (c=53) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 35 return (c >= (wint_t)'0' && c <= (wint_t)'9'); (gdb) p/x c $81 = 0x35 (gdb) finish Run till exit from #0 iswdigit (c=53) at /usr/src/debug/cygwin-1.7.27-2/newlib/libc/ctype/iswdigit.c:35 0x0060c510 in TParserGet (prs=0x80100930) at /pub/devel/postgresql/postgresql-9.3.2-2/src/postgresql-9.3.2/src/backend/tsearch/wparser_def.c:1834 1834 if (item->isclass(prs) != 0) Value returned is $82 = 1 ------------------------------------------------------------------------- -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs