diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index d771b92660a..6129db455dd 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.121 2008/01/01 19:46:00 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.121.2.1 2008/10/09 16:35:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1903,12 +1903,15 @@ compute_function_hashkey(FunctionCallInfo fcinfo, /* get function OID */ hashkey->funcOid = fcinfo->flinfo->fn_oid; + /* get call context */ + hashkey->isTrigger = CALLED_AS_TRIGGER(fcinfo); + /* * if trigger, get relation OID. In validation mode we do not know what * relation is intended to be used, so we leave trigrelOid zero; the hash * entry built in this case will never really be used. */ - if (CALLED_AS_TRIGGER(fcinfo) && !forValidator) + if (hashkey->isTrigger && !forValidator) { TriggerData *trigdata = (TriggerData *) fcinfo->context; diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 36e5b075862..9736befcc8f 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.95 2008/01/01 19:46:00 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.95.2.1 2008/10/09 16:35:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -541,6 +541,10 @@ typedef struct PLpgSQL_func_hashkey { /* Hash lookup key for functions */ Oid funcOid; + bool isTrigger; /* true if called as a trigger */ + + /* be careful that pad bytes in this struct get zeroed! */ + /* * For a trigger function, the OID of the relation triggered on is part of * the hashkey --- we want to compile the trigger separately for each