On Wed, Mar 05, 2008 at 10:53:38AM -0500, Bruce Momjian wrote:
> 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 report 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)

Is it possible to make it a WARNING instead of an ERROR? Right now I get:

NOTICE: word is too long to be indexed
DETAIL: Words longer than 2047 characters are ignored. 

when updating the dictionary on a table, which will make it continue,
but with some long messages I get:

ERROR: string is too long for tsvector 

Which is quite fatal for the whole UPDATE / INSERT statement.

Edwin

--
Edwin Groothuis      |            Personal website: http://www.mavetju.org
[EMAIL PROTECTED]    |              Weblog: http://www.mavetju.org/weblog/

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

Reply via email to