pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
5+ messages / 2 participants
[nested] [flat]

* pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
@ 2016-03-16 14:48  Teodor Sigaev <teodor@sigaev.ru>
  0 siblings, 1 reply; 5+ messages in thread

From: Teodor Sigaev @ 2016-03-16 14:48 UTC (permalink / raw)
  To: pgsql-committers

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
@ 2016-03-17 17:11  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Teodor Sigaev <teodor@sigaev.ru>
  0 siblings, 2 replies; 5+ messages in thread

From: Tom Lane @ 2016-03-17 17:11 UTC (permalink / raw)
  To: Teodor Sigaev <teodor@sigaev.ru>; +Cc: pgsql-committers

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
@ 2016-03-17 17:31  Teodor Sigaev <teodor@sigaev.ru>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Teodor Sigaev @ 2016-03-17 17:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers

> 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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
@ 2016-03-17 17:59  Teodor Sigaev <teodor@sigaev.ru>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 5+ messages in thread

From: Teodor Sigaev @ 2016-03-17 17:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers

> 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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit()
@ 2016-03-17 18:02  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Teodor Sigaev <teodor@sigaev.ru>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2016-03-17 18:02 UTC (permalink / raw)
  To: Teodor Sigaev <teodor@sigaev.ru>; +Cc: pgsql-committers

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2016-03-17 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-03-16 14:48 pgsql: GUC variable pg_trgm.similarity_threshold insead of set_limit() Teodor Sigaev <teodor@sigaev.ru>
2016-03-17 17:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-03-17 17:31   ` Teodor Sigaev <teodor@sigaev.ru>
2016-03-17 17:59   ` Teodor Sigaev <teodor@sigaev.ru>
2016-03-17 18:02     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox