From: | Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru> |
---|---|
To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Ensure that maxlen is an integer value in dict_int configuration |
Date: | 2018-03-27 13:04:00 |
Message-ID: | 20180327130359.GA4520@zakirov.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 27, 2018 at 01:17:20PM +0200, Daniel Gustafsson wrote:
> 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)
But the patch breaks options parsing in another place. After the patch:
=# alter text search dictionary intdict (maxlen = 3, rejectlong = true);
ALTER TEXT SEARCH DICTIONARY
=# select ts_lexize('intdict', '12345678');
ERROR: maxlen requires an integer value
It is because all options are stored as string:
=# select dictinitoption from pg_ts_dict where dictname = 'intdict';
dictinitoption
-----------------------------------
maxlen = '5', rejectlong = 'true'
So the right fix could be as it done in postgres_fdw_validator() for
'fetch_size' option.
--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2018-03-27 13:17:00 | pgbench doc typos |
Previous Message | Michael Paquier | 2018-03-27 13:02:26 | Re: Problem while setting the fpw with SIGHUP |