summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/dict_int/dict_int.c5
-rw-r--r--contrib/dict_int/expected/dict_int.out2
-rw-r--r--contrib/dict_int/sql/dict_int.sql2
3 files changed, 9 insertions, 0 deletions
diff --git a/contrib/dict_int/dict_int.c b/contrib/dict_int/dict_int.c
index 628b9769c32..9d1b4b0955b 100644
--- a/contrib/dict_int/dict_int.c
+++ b/contrib/dict_int/dict_int.c
@@ -45,6 +45,11 @@ dintdict_init(PG_FUNCTION_ARGS)
if (strcmp(defel->defname, "maxlen") == 0)
{
d->maxlen = atoi(defGetString(defel));
+
+ if (d->maxlen < 1)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("maxlen value has to be >= 1")));
}
else if (strcmp(defel->defname, "rejectlong") == 0)
{
diff --git a/contrib/dict_int/expected/dict_int.out b/contrib/dict_int/expected/dict_int.out
index 3b766ec52ad..483e700d231 100644
--- a/contrib/dict_int/expected/dict_int.out
+++ b/contrib/dict_int/expected/dict_int.out
@@ -300,3 +300,5 @@ select ts_lexize('intdict', '314532610153');
{314532}
(1 row)
+ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = -214783648);
+ERROR: maxlen value has to be >= 1
diff --git a/contrib/dict_int/sql/dict_int.sql b/contrib/dict_int/sql/dict_int.sql
index 8ffec6b7708..5c27accff4a 100644
--- a/contrib/dict_int/sql/dict_int.sql
+++ b/contrib/dict_int/sql/dict_int.sql
@@ -51,3 +51,5 @@ select ts_lexize('intdict', '252281774');
select ts_lexize('intdict', '313425');
select ts_lexize('intdict', '641439323669');
select ts_lexize('intdict', '314532610153');
+
+ALTER TEXT SEARCH DICTIONARY intdict (MAXLEN = -214783648);