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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
Cc: Edwin Groothuis <postgresql(at)mavetju(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #3975: tsearch2 index should not bomb out of 1Mb limit
Date: 2008-03-05 15:53:38
Message-ID: 200803051553.m25Frct09843@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

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)

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

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

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

Attachment Content-Type Size
/rtmp/diff text/x-diff 3.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2008-03-05 16:20:32 Re: [BUGS] BUG #3965: UNIQUE constraint fails on long column values
Previous Message Rodriguez Fernando 2008-03-05 14:36:48 Re:

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-03-05 17:00:57 Re: Endless recovery
Previous Message Magnus Hagander 2008-03-05 15:20:27 Re: WIP: guc enums