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

Started by Teodor Sigaevover 10 years ago5 messagescomitters
Jump to latest
#1Teodor Sigaev
teodor@sigaev.ru

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(-)

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#1)
Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

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

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Tom Lane (#2)
Re: pgsql: 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.

will fix

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

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#4Teodor Sigaev
teodor@sigaev.ru
In reply to: Tom Lane (#2)
Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

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/

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#4)
Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()

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

--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers