pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marco Atzeri <marco.atzeri@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8970: ts_parse incorrectly split numbers in digit token
Date: Sat, 01 Feb 2014 17:27:11 -0500
Message-ID: <15800.1391293631@sss.pgh.pa.us> (raw)
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Marco Atzeri <marco.atzeri@gmail.com> 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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

fix-wchar_t-width-assumption.patch (text/x-diff, 2.6K) download diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_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 */ #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. */ #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 = *(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; ! return isalnum(0xff & c); } ! return iswalnum((wint_t) *(prs->wstr + prs->state->poschar)); } return isalnum(*(unsigned char *) (prs->str + prs->state->posbyte)); --- 479,488 ---- if (c > 0x7f) return 1; ! return isalnum(c); } ! return iswalnum(*(prs->wstr + prs->state->poschar)); } return isalnum(*(unsigned char *) (prs->str + prs->state->posbyte)); *************** p_isalpha(TParser *prs) *** 507,516 **** if (c > 0x7f) return 1; ! return isalpha(0xff & c); } ! return iswalpha((wint_t) *(prs->wstr + prs->state->poschar)); } return isalpha(*(unsigned char *) (prs->str + prs->state->posbyte)); --- 511,520 ---- if (c > 0x7f) return 1; ! return isalpha(c); } ! return iswalpha(*(prs->wstr + prs->state->poschar)); } return isalpha(*(unsigned char *) (prs->str + prs->state->posbyte));

view thread (11+ messages)  latest in thread

Message-ID: <15800.1391293631@sss.pgh.pa.us>
Permalink:  ../15800.1391293631@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15800.1391293631@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, marco.atzeri@gmail.com
  Subject: Re: BUG #8970: ts_parse incorrectly split numbers in digit token
  In-Reply-To: <15800.1391293631@sss.pgh.pa.us>
  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> <15800.1391293631@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox