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.
This commit is contained in:
parent
61fd2c51d8
commit
3ca7eddbb7
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.8 2009/01/01 17:23:32 momjian Exp $
|
* $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.9 2009/01/28 18:31:32 teodor Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -367,8 +367,10 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
|
|||||||
{
|
{
|
||||||
TriggerData *trigdata;
|
TriggerData *trigdata;
|
||||||
Trigger *trigger;
|
Trigger *trigger;
|
||||||
char **tgargs;
|
char **tgargs,
|
||||||
|
**tgargs_old;
|
||||||
int i;
|
int i;
|
||||||
|
Datum res;
|
||||||
|
|
||||||
/* Check call context */
|
/* Check call context */
|
||||||
if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
|
if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
|
||||||
@ -388,10 +390,20 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
tgargs[1] = pstrdup(GetConfigOptionByName("default_text_search_config",
|
tgargs[1] = pstrdup(GetConfigOptionByName("default_text_search_config",
|
||||||
NULL));
|
NULL));
|
||||||
|
tgargs_old = trigger->tgargs;
|
||||||
trigger->tgargs = tgargs;
|
trigger->tgargs = tgargs;
|
||||||
trigger->tgnargs++;
|
trigger->tgnargs++;
|
||||||
|
|
||||||
return tsvector_update_trigger_byid(fcinfo);
|
res = tsvector_update_trigger_byid(fcinfo);
|
||||||
|
|
||||||
|
/* restore old trigger data */
|
||||||
|
trigger->tgargs = tgargs_old;
|
||||||
|
trigger->tgnargs--;
|
||||||
|
|
||||||
|
pfree(tgargs[1]);
|
||||||
|
pfree(tgargs);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user