Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit3ca7edd

Browse files
committed
Fix bug with multiple evaluation of tsearch2 compatibility trigger, trigger
data should be restored.Backpatch only for 8.3 because previous versions haven't such layer.
1 parent61fd2c5 commit3ca7edd

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎contrib/tsearch2/tsearch2.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.8 2009/01/01 17:23:32momjian Exp $
10+
* $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.9 2009/01/28 18:31:32teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -367,8 +367,10 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
367367
{
368368
TriggerData*trigdata;
369369
Trigger*trigger;
370-
char**tgargs;
370+
char**tgargs,
371+
**tgargs_old;
371372
inti;
373+
Datumres;
372374

373375
/* Check call context */
374376
if (!CALLED_AS_TRIGGER(fcinfo))/* internal error */
@@ -388,10 +390,20 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
388390

389391
tgargs[1]=pstrdup(GetConfigOptionByName("default_text_search_config",
390392
NULL));
393+
tgargs_old=trigger->tgargs;
391394
trigger->tgargs=tgargs;
392395
trigger->tgnargs++;
393396

394-
returntsvector_update_trigger_byid(fcinfo);
397+
res=tsvector_update_trigger_byid(fcinfo);
398+
399+
/* restore old trigger data */
400+
trigger->tgargs=tgargs_old;
401+
trigger->tgnargs--;
402+
403+
pfree(tgargs[1]);
404+
pfree(tgargs);
405+
406+
returnres;
395407
}
396408

397409

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp