When text search string is too long, in error message report actual and
authorBruce Momjian <bruce@momjian.us>
Wed, 5 Mar 2008 15:50:37 +0000 (15:50 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 5 Mar 2008 15:50:37 +0000 (15:50 +0000)
maximum number of bytes allowed.

src/backend/tsearch/to_tsany.c
src/backend/utils/adt/tsvector.c
src/backend/utils/adt/tsvector_op.c

index 71f4db3a54e9ff97319aa3611b25f9a9bd101844..06855fb025b587f8a8d41ada4b3cc0c740320647 100644 (file)
@@ -163,7 +163,7 @@ make_tsvector(ParsedText *prs)
        if (lenstr > MAXSTRPOS)
                ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                                errmsg("string is too long for tsvector")));
+                                       errmsg("string is too long for tsvector (%d bytes, max %d bytes)", lenstr, MAXSTRPOS)));
 
        totallen = CALCDATASIZE(prs->curwords, lenstr);
        in = (TSVector) palloc0(totallen);
index 931ef0ee6515794879fea887530a46832741dd7c..bd26f40297d5dc6c09831633d87782d491bc13a8 100644 (file)
@@ -224,7 +224,7 @@ tsvectorin(PG_FUNCTION_ARGS)
                if (cur - tmpbuf > MAXSTRPOS)
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                                        errmsg("string is too long for tsvector")));
+                                        errmsg("string is too long for tsvector (%d bytes, max %d bytes)", cur - tmpbuf, MAXSTRPOS)));
 
                /*
                 * Enlarge buffers if needed
@@ -273,7 +273,7 @@ tsvectorin(PG_FUNCTION_ARGS)
        if (buflen > MAXSTRPOS)
                ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                                errmsg("string is too long for tsvector")));
+                                errmsg("string is too long for tsvector (%d bytes, max %d bytes)", buflen, MAXSTRPOS)));
 
        totallen = CALCDATASIZE(len, buflen);
        in = (TSVector) palloc0(totallen);
index f4c50e5039272f3daa25c7aba0f0ec8e4670bad9..b88064fcb7fc606eb3e7168ffecfe26ee0ffbc5d 100644 (file)
@@ -488,7 +488,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
        if (dataoff > MAXSTRPOS)
                ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                                errmsg("string is too long for tsvector")));
+                                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));