Ensure that maxlen is an integer value in dict_int configuration - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Ensure that maxlen is an integer value in dict_int configuration
Date
Msg-id F39EB4FB-62A7-4F01-93A8-0570CC485F4B@yesql.se
Whole thread Raw
Responses Re: Ensure that maxlen is an integer value in dict_int configuration  (Arthur Zakirov <a.zakirov@postgrespro.ru>)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: [HACKERS] GUC for cleanup indexes threshold.
Next
From: Robert Haas
Date:
Subject: Re: Parallel safety of binary_upgrade_create_empty_extension