diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 186520377ce..210c692f21a 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.94.2.4 2007/02/08 18:37:52 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.94.2.5 2008/10/09 16:35:25 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -2075,12 +2075,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 d27ea9eab53..fef84a77dcb 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.65.2.3 2007/01/30 22:05:25 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.65.2.4 2008/10/09 16:35:25 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -546,6 +546,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