postgresql/contrib/pg_trgm
Tom Lane ea268cdc9a Add macros to make AllocSetContextCreate() calls simpler and safer.
I found that half a dozen (nearly 5%) of our AllocSetContextCreate calls
had typos in the context-sizing parameters.  While none of these led to
especially significant problems, they did create minor inefficiencies,
and it's now clear that expecting people to copy-and-paste those calls
accurately is not a great idea.  Let's reduce the risk of future errors
by introducing single macros that encapsulate the common use-cases.
Three such macros are enough to cover all but two special-purpose contexts;
those two calls can be left as-is, I think.

While this patch doesn't in itself improve matters for third-party
extensions, it doesn't break anything for them either, and they can
gradually adopt the simplified notation over time.

In passing, change TopMemoryContext to use the default allocation
parameters.  Formerly it could only be extended 8K at a time.  That was
probably reasonable when this code was written; but nowadays we create
many more contexts than we did then, so that it's not unusual to have a
couple hundred K in TopMemoryContext, even without considering various
dubious code that sticks other things there.  There seems no good reason
not to let it use growing blocks like most other contexts.

Back-patch to 9.6, mostly because that's still close enough to HEAD that
it's easy to do so, and keeping the branches in sync can be expected to
avoid some future back-patching pain.  The bugs fixed by these changes
don't seem to be significant enough to justify fixing them further back.

Discussion: <21072.1472321324@sss.pgh.pa.us>
2016-08-27 17:50:38 -04:00
..
data Add files forgotten in f576b17cd6 2016-03-16 19:23:41 +03:00
expected Fix comparison of similarity to threshold in GIST trigram searches. 2016-06-20 10:49:19 -04:00
sql Fix comparison of similarity to threshold in GIST trigram searches. 2016-06-20 10:49:19 -04:00
.gitignore
Makefile Handle contrib's GIN/GIST support function signature changes honestly. 2016-06-09 16:44:25 -04:00
pg_trgm--1.0--1.1.sql
pg_trgm--1.1--1.2.sql Add word_similarity to pg_trgm contrib module. 2016-03-16 18:59:21 +03:00
pg_trgm--1.2--1.3.sql pg_trgm's set_limit() function is parallel unsafe, not parallel restricted. 2016-06-20 11:29:54 -04:00
pg_trgm--1.3.sql pg_trgm's set_limit() function is parallel unsafe, not parallel restricted. 2016-06-20 11:29:54 -04:00
pg_trgm--unpackaged--1.0.sql
pg_trgm.control Handle contrib's GIN/GIST support function signature changes honestly. 2016-06-09 16:44:25 -04:00
trgm_gin.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
trgm_gist.c Fix comparison of similarity to threshold in GIST trigram searches. 2016-06-20 10:49:19 -04:00
trgm_op.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
trgm_regexp.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
trgm.h Add word_similarity to pg_trgm contrib module. 2016-03-16 18:59:21 +03:00