Обсуждение: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

Поиск
Список
Период
Сортировка

pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

От
Teodor Sigaev
Дата:
GUC variable pg_trgm.similarity_threshold insead of set_limit()

Use GUC variable pg_trgm.similarity_threshold insead of
set_limit()/show_limit() which was introduced when defining GUC varuables
by modules was absent.

Author: Artur Zakirov

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/5871b88487cfd07966e2ce08609a4d6d5ee9718e

Modified Files
--------------
contrib/pg_trgm/pg_trgm--1.2.sql |  4 +++-
contrib/pg_trgm/trgm.h           |  2 +-
contrib/pg_trgm/trgm_gin.c       |  8 +++++--
contrib/pg_trgm/trgm_gist.c      |  6 ++++--
contrib/pg_trgm/trgm_op.c        | 45 ++++++++++++++++++++++++++++++++++------
doc/src/sgml/pgtrgm.sgml         | 28 ++++++++++++++++++++++---
6 files changed, 78 insertions(+), 15 deletions(-)


Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

От
Tom Lane
Дата:
Teodor Sigaev <teodor@sigaev.ru> writes:
> GUC variable pg_trgm.similarity_threshold insead of set_limit()

If that's to be an actual GUC variable, it's not okay for set_limit()
to just do this:

    similarity_threshold = nlimit;

It should go through SetConfigOption(); compare for example
tsa_set_curcfg_byname().  Which would also mean you could drop the
range-checking code there, because guc.c would enforce it.

            regards, tom lane


Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

От
Teodor Sigaev
Дата:
> If that's to be an actual GUC variable, it's not okay for set_limit()
> to just do this:
>
>     similarity_threshold = nlimit;
>
> It should go through SetConfigOption(); compare for example
> tsa_set_curcfg_byname().  Which would also mean you could drop the
> range-checking code there, because guc.c would enforce it.

will fix

--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

От
Teodor Sigaev
Дата:
> It should go through SetConfigOption(); compare for example
> tsa_set_curcfg_byname().  Which would also mean you could drop the

Seems, also show_limit() should use GetConfigOption()?

--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

От
Tom Lane
Дата:
Teodor Sigaev <teodor@sigaev.ru> writes:
>> It should go through SetConfigOption(); compare for example
>> tsa_set_curcfg_byname().  Which would also mean you could drop the

> Seems, also show_limit() should use GetConfigOption()?

Nah, that's overkill.  The current contents of similarity_threshold are
always the current state of the GUC variable.  The problem with just
assigning to the variable is that then guc.c doesn't know what you did
and might overwrite the value later.

            regards, tom lane