I recently had a usecase for dict_int, typoed my script and spent longer than
I’d like to admit finding said typo.  The attached patch scratches my itch by
ensuring that the maxlen parameter to dict_int is integer, instead of silently
setting it to zero on malformed input. Instead of this:

dg=# alter text search dictionary intdict (maxlen = a, rejectlong = true);
ALTER TEXT SEARCH DICTIONARY
dg=# select ts_lexize('intdict', '12345678');
 ts_lexize
-----------
 {}
(1 row)

.. the attached will error out with “ERROR: maxlen is out of range, must
be integer”, and be more in line with how we handle DefElem values.  A quick
grep around the tree didn’t turn up any other defelems doing this so I think
this is the only callsite.

cheers ./daniel

Attachment: dict_int_maxlen.patch
Description: Binary data

Reply via email to