Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: [BUGS] BUG ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 14 Topic 3455 of 4253
Post > Topic >>

Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of

by bruce@[EMAIL PROTECTED] (Bruce Momjian) Mar 5, 2008 at 10:53 AM

--ELM1204732418-5813-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"

Euler Taveira de Oliveira wrote:
> Edwin Groothuis wrote:
> 
> > Ouch. But... since very long words are already not indexed (is the
length
> > configurable anywhere because I don't mind setting it to 50
characters), I
> > don't think that it should bomb out of this but print a similar
warning like
> > "String only partly indexed".
> > 
> This is not a bug. I would say it's a limitation. Look at 
> src/include/tsearch/ts_type.h. You could decrease len in WordEntry to 9 
> (512 characters) and increase pos to 22 (4 Mb). Don't forget to update 
> MAXSTRLEN and MAXSTRPOS accordingly.
> 
> > I'm still trying to determine how big the message it failed on was...
> > 
> Maybe we should change the "string is too long for tsvector" to "string 
> is too long (%ld bytes, max %ld bytes) for tsvector".

Good idea.  I have applied the following patch to re****t in the error
message the string length and maximum, like we already do for long
words:

Old:
	test=> select repeat('a', 3000)::tsvector;
	ERROR:  word is too long (3000 bytes, max 2046 bytes)

New:
	test=> select repeat('a ', 3000000)::tsvector;
	ERROR:  string is too long for tsvector (1048576 bytes, max 1048575
bytes)

I did not backpatch this to 8.3 because it would require translation
string updates.

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

  + If your life is a hard drive, Christ can be your backup. +

--ELM1204732418-5813-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/rtmp/diff"

Index: src/backend/tsearch/to_tsany.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tsearch/to_tsany.c,v
retrieving revision 1.8
diff -c -c -r1.8 to_tsany.c
*** src/backend/tsearch/to_tsany.c	1 Jan 2008 19:45:52 -0000	1.8
--- src/backend/tsearch/to_tsany.c	5 Mar 2008 15:41:36 -0000
***************
*** 163,169 ****
  	if (lenstr > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 errmsg("string is too long for tsvector")));
  
  	totallen = CALCDATASIZE(prs->curwords, lenstr);
  	in = (TSVector) palloc0(totallen);
--- 163,169 ----
  	if (lenstr > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 	errmsg("string is too long for tsvector (%d bytes, max %d bytes)",
lenstr, MAXSTRPOS)));
  
  	totallen = CALCDATASIZE(prs->curwords, lenstr);
  	in = (TSVector) palloc0(totallen);
Index: src/backend/utils/adt/tsvector.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/tsvector.c,v
retrieving revision 1.11
diff -c -c -r1.11 tsvector.c
*** src/backend/utils/adt/tsvector.c	1 Jan 2008 19:45:53 -0000	1.11
--- src/backend/utils/adt/tsvector.c	5 Mar 2008 15:41:36 -0000
***************
*** 224,230 ****
  		if (cur - tmpbuf > MAXSTRPOS)
  			ere****t(ERROR,
  					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 					 errmsg("string is too long for tsvector")));
  
  		/*
  		 * Enlarge buffers if needed
--- 224,230 ----
  		if (cur - tmpbuf > MAXSTRPOS)
  			ere****t(ERROR,
  					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 	 errmsg("string is too long for tsvector (%d bytes, max %d
bytes)", cur - tmpbuf, MAXSTRPOS)));
  
  		/*
  		 * Enlarge buffers if needed
***************
*** 273,279 ****
  	if (buflen > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 errmsg("string is too long for tsvector")));
  
  	totallen = CALCDATASIZE(len, buflen);
  	in = (TSVector) palloc0(totallen);
--- 273,279 ----
  	if (buflen > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 errmsg("string is too long for tsvector (%d bytes, max %d bytes)",
buflen, MAXSTRPOS)));
  
  	totallen = CALCDATASIZE(len, buflen);
  	in = (TSVector) palloc0(totallen);
Index: src/backend/utils/adt/tsvector_op.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/tsvector_op.c,v
retrieving revision 1.12
diff -c -c -r1.12 tsvector_op.c
*** src/backend/utils/adt/tsvector_op.c	1 Jan 2008 19:45:53 -0000	1.12
--- src/backend/utils/adt/tsvector_op.c	5 Mar 2008 15:41:36 -0000
***************
*** 488,494 ****
  	if (dataoff > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 errmsg("string is too long for tsvector")));
  
  	out->size = ptr - ARRPTR(out);
  	SET_VARSIZE(out, CALCDATASIZE(out->size, dataoff));
--- 488,494 ----
  	if (dataoff > MAXSTRPOS)
  		ere****t(ERROR,
  				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
! 				 errmsg("string is too long for tsvector (%d bytes, max %d bytes)",
dataoff, MAXSTRPOS)));
  
  	out->size = ptr - ARRPTR(out);
  	SET_VARSIZE(out, CALCDATASIZE(out->size, dataoff));

--ELM1204732418-5813-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


--
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-patches

--ELM1204732418-5813-0_--
 




 14 Posts in Topic:
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of
bruce@[EMAIL PROTECTED]   2008-03-05 10:53:38 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
postgresql@[EMAIL PROTECT  2008-03-06 07:49:22 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
euler@[EMAIL PROTECTED]   2008-03-06 20:19:35 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
edwin@[EMAIL PROTECTED]   2008-03-07 10:42:32 
Re: [BUGS] BUG #3975: tsearch2 index should not
bruce@[EMAIL PROTECTED]   2008-03-07 07:19:35 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
tgl@[EMAIL PROTECTED] (T  2008-03-06 20:05:02 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out
euler@[EMAIL PROTECTED]   2008-03-07 03:14:09 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
tgl@[EMAIL PROTECTED] (T  2008-03-07 01:52:24 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out
euler@[EMAIL PROTECTED]   2008-03-09 23:08:36 
Re: [BUGS] BUG #3975: tsearch2 index should not
bruce@[EMAIL PROTECTED]   2008-03-07 07:18:54 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb
tgl@[EMAIL PROTECTED] (T  2008-03-07 08:12:29 
Re: [BUGS] BUG #3975: tsearch2 index should not
bruce@[EMAIL PROTECTED]   2008-03-07 08:22:56 
Re: [BUGS] BUG #3975: tsearch2 index should not bomb out
teodor@[EMAIL PROTECTED]   2008-03-07 16:56:40 
Re: [BUGS] BUG #3975: tsearch2 index should not
bruce@[EMAIL PROTECTED]   2008-05-07 00:12:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 6:00:02 CST 2008.