Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ae4fc52

Browse filesBrowse files
Check for interrupts in pg_trgm word similarity
Calculating similarity between large strings can be timesconsuming and overrun configured statement timeouts. Check for interrupts in the main loop to ensure query cancellation can be performed. Author: Robins Tharakan <tharakan@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAEP4nAxvmfc_XWTz73bqXRhgjONi=1HaX4_NhsopA3L6UvnN1g@mail.gmail.com
1 parent 519be09 commit ae4fc52
Copy full SHA for ae4fc52

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎contrib/pg_trgm/trgm_op.c

Copy file name to clipboardExpand all lines: contrib/pg_trgm/trgm_op.c
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "catalog/pg_type.h"
99
#include "lib/qunique.h"
10+
#include "miscadmin.h"
1011
#include "trgm.h"
1112
#include "tsearch/ts_locale.h"
1213
#include "utils/lsyscache.h"
@@ -492,8 +493,12 @@ iterate_word_similarity(int *trg2indexes,
492493

493494
for (i = 0; i < len2; i++)
494495
{
496+
int trgindex;
497+
498+
CHECK_FOR_INTERRUPTS();
499+
495500
/* Get index of next trigram */
496-
int trgindex = trg2indexes[i];
501+
trgindex = trg2indexes[i];
497502

498503
/* Update last position of this trigram */
499504
if (lower >= 0 || found[trgindex])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.