Re: [PATCHES] GIN improvements

2008-06-17 Thread Tom Lane
Teodor Sigaev <[EMAIL PROTECTED]> writes:
> So, I didn't see any comments/objections and I intend to commit this patch 
> for 
> next two days and synchronize 'fast insert into GIN' patch with CVS.
> Objections?

I think it hasn't really gotten reviewed at all (certainly not by me).
If you want other people to look it over you should wait for next
month's commit fest.

regards, tom lane

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


Re: [PATCHES] GIN improvements

2008-06-17 Thread Teodor Sigaev



1) multicolumn GIN
Unlike other indexes, the performance of search 
doesn't depends on what column of index (first, last, any subset) is 
used in search clause. This property can be used in gincostestimate, but 
I haven't looked on it yet.


After some playing I didn't find any mentions in *costestimate function about 
difference of cost estimation between first and any other columns in clauses, 
so, IMHO, issue above isn't an issue. :)


So, I didn't see any comments/objections and I intend to commit this patch for 
next two days and synchronize 'fast insert into GIN' patch with CVS.


Objections?

--
Teodor Sigaev   E-mail: [EMAIL PROTECTED]
   WWW: http://www.sigaev.ru/

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


Re: [PATCHES] Simplify formatting.c

2008-06-17 Thread Bruce Momjian
Alvaro Herrera wrote:
> Bruce Momjian wrote:
> 
> > I moved str_initcap() over into oracle_compat.c and then had initcap()
> > convert to/from TEXT to call it.  The code is a little weird because
> > str_initcap() needs to convert to text to use texttowcs(), so in
> > multibyte encodings initcap converts the string to text, then to char,
> > then to text to call texttowcs().  I didn't see a cleaner way to do
> > this.
> 
> Why not use wchar2char?  It seems there's room for extra cleanup here.
> 
> Also, the prototype of str_initcap in builtins.h looks out of place.

I talked to Alvaro on IM, and there is certainly much more cleanup to do
in this area. I will work from the bottom up.  First, is moving the
USE_WIDE_UPPER_LOWER define to c.h, and removing TS_USE_WIDE and using
USE_WIDE_UPPER_LOWER instead.  Patch attached and applied.

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/tsearch/regis.c
===
RCS file: /cvsroot/pgsql/src/backend/tsearch/regis.c,v
retrieving revision 1.4
diff -c -c -r1.4 regis.c
*** src/backend/tsearch/regis.c	21 Jan 2008 02:46:10 -	1.4
--- src/backend/tsearch/regis.c	17 Jun 2008 16:06:54 -
***
*** 178,184 
  	r->node = NULL;
  }
  
! #ifdef TS_USE_WIDE
  static bool
  mb_strchr(char *str, char *c)
  {
--- 178,184 
  	r->node = NULL;
  }
  
! #ifdef USE_WIDE_UPPER_LOWER
  static bool
  mb_strchr(char *str, char *c)
  {
Index: src/backend/tsearch/ts_locale.c
===
RCS file: /cvsroot/pgsql/src/backend/tsearch/ts_locale.c,v
retrieving revision 1.7
diff -c -c -r1.7 ts_locale.c
*** src/backend/tsearch/ts_locale.c	1 Jan 2008 19:45:52 -	1.7
--- src/backend/tsearch/ts_locale.c	17 Jun 2008 16:06:54 -
***
*** 17,23 
  #include "tsearch/ts_public.h"
  
  
! #ifdef TS_USE_WIDE
  
  /*
   * wchar2char --- convert wide characters to multibyte format
--- 17,23 
  #include "tsearch/ts_public.h"
  
  
! #ifdef USE_WIDE_UPPER_LOWER
  
  /*
   * wchar2char --- convert wide characters to multibyte format
***
*** 190,196 
  
  	return iswprint((wint_t) character[0]);
  }
! #endif   /* TS_USE_WIDE */
  
  
  /*
--- 190,196 
  
  	return iswprint((wint_t) character[0]);
  }
! #endif   /* USE_WIDE_UPPER_LOWER */
  
  
  /*
***
*** 260,266 
  	if (len == 0)
  		return pstrdup("");
  
! #ifdef TS_USE_WIDE
  
  	/*
  	 * Use wide char code only when max encoding length > 1 and ctype != C.
--- 260,266 
  	if (len == 0)
  		return pstrdup("");
  
! #ifdef USE_WIDE_UPPER_LOWER
  
  	/*
  	 * Use wide char code only when max encoding length > 1 and ctype != C.
***
*** 307,313 
  		Assert(wlen < len);
  	}
  	else
! #endif   /* TS_USE_WIDE */
  	{
  		const char *ptr = str;
  		char	   *outptr;
--- 307,313 
  		Assert(wlen < len);
  	}
  	else
! #endif   /* USE_WIDE_UPPER_LOWER */
  	{
  		const char *ptr = str;
  		char	   *outptr;
Index: src/backend/tsearch/wparser_def.c
===
RCS file: /cvsroot/pgsql/src/backend/tsearch/wparser_def.c,v
retrieving revision 1.14
diff -c -c -r1.14 wparser_def.c
*** src/backend/tsearch/wparser_def.c	1 Jan 2008 19:45:52 -	1.14
--- src/backend/tsearch/wparser_def.c	17 Jun 2008 16:06:54 -
***
*** 238,244 
  	/* string and position information */
  	char	   *str;			/* multibyte string */
  	int			lenstr;			/* length of mbstring */
! #ifdef TS_USE_WIDE
  	wchar_t*wstr;			/* wide character string */
  	int			lenwstr;		/* length of wsting */
  #endif
--- 238,244 
  	/* string and position information */
  	char	   *str;			/* multibyte string */
  	int			lenstr;			/* length of mbstring */
! #ifdef USE_WIDE_UPPER_LOWER
  	wchar_t*wstr;			/* wide character string */
  	int			lenwstr;		/* length of wsting */
  #endif
***
*** 291,297 
  	prs->str = str;
  	prs->lenstr = len;
  
! #ifdef TS_USE_WIDE
  
  	/*
  	 * Use wide char code only when max encoding length > 1.
--- 291,297 
  	prs->str = str;
  	prs->lenstr = len;
  
! #ifdef USE_WIDE_UPPER_LOWER
  
  	/*
  	 * Use wide char code only when max encoding length > 1.
***
*** 328,334 
  		prs->state = ptr;
  	}
  
! #ifdef TS_USE_WIDE
  	if (prs->wstr)
  		pfree(prs->wstr);
  #endif
--- 328,334 
  		prs->state = ptr;
  	}
  
! #ifdef USE_WIDE_UPPER_LOWER
  	if (prs->wstr)
  		pfree(prs->wstr);
  #endif
***
*** 344,350 
   * often are used for Asian languages
   */
  
! #ifdef TS_USE_WIDE
  
  #define p_iswhat(type)		\
  static int	\
--- 344,350 
   * often are used for Asian languages
   */
  
! #ifdef USE_WIDE_UPPER_LOWER
  
  #define p_iswhat(type)