Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit910bc51

Browse files
committed
When text search string is too long, in error message report actual and
maximum number of bytes allowed.
1 parent0e50b08 commit910bc51

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎src/backend/tsearch/to_tsany.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.8 2008/01/01 19:45:52 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/to_tsany.c,v 1.9 2008/03/05 15:50:37 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -163,7 +163,7 @@ make_tsvector(ParsedText *prs)
163163
if (lenstr>MAXSTRPOS)
164164
ereport(ERROR,
165165
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
166-
errmsg("string is too long for tsvector")));
166+
errmsg("string is too long for tsvector (%d bytes, max %d bytes)",lenstr,MAXSTRPOS)));
167167

168168
totallen=CALCDATASIZE(prs->curwords,lenstr);
169169
in= (TSVector)palloc0(totallen);

‎src/backend/utils/adt/tsvector.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.11 2008/01/01 19:45:53 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.12 2008/03/05 15:50:37 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -224,7 +224,7 @@ tsvectorin(PG_FUNCTION_ARGS)
224224
if (cur-tmpbuf>MAXSTRPOS)
225225
ereport(ERROR,
226226
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
227-
errmsg("string is too long for tsvector")));
227+
errmsg("string is too long for tsvector (%d bytes, max %d bytes)",cur-tmpbuf,MAXSTRPOS)));
228228

229229
/*
230230
* Enlarge buffers if needed
@@ -273,7 +273,7 @@ tsvectorin(PG_FUNCTION_ARGS)
273273
if (buflen>MAXSTRPOS)
274274
ereport(ERROR,
275275
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
276-
errmsg("string is too long for tsvector")));
276+
errmsg("string is too long for tsvector (%d bytes, max %d bytes)",buflen,MAXSTRPOS)));
277277

278278
totallen=CALCDATASIZE(len,buflen);
279279
in= (TSVector)palloc0(totallen);

‎src/backend/utils/adt/tsvector_op.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.12 2008/01/01 19:45:53 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector_op.c,v 1.13 2008/03/05 15:50:37 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -488,7 +488,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
488488
if (dataoff>MAXSTRPOS)
489489
ereport(ERROR,
490490
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
491-
errmsg("string is too long for tsvector")));
491+
errmsg("string is too long for tsvector (%d bytes, max %d bytes)",dataoff,MAXSTRPOS)));
492492

493493
out->size=ptr-ARRPTR(out);
494494
SET_VARSIZE(out,CALCDATASIZE(out->size,dataoff));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp