aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-07-20 16:20:15 -0400
committerRobert Haas <rhaas@postgresql.org>2012-07-20 16:22:11 -0400
commit0a248208a038d7847ef98996c6b70209d782415c (patch)
treed27cd2fab0f9d57eddb178b1eccf9bbd5033c81c /src
parentae55d9fbe3871a5e6309d9b91629f1b0ff2b8cba (diff)
downloadpostgresql-0a248208a038d7847ef98996c6b70209d782415c.tar.gz
postgresql-0a248208a038d7847ef98996c6b70209d782415c.zip
Temporary patch to try to debug why event trigger patch broke Windows.
Apologies for the ugliness.
Diffstat (limited to 'src')
-rw-r--r--src/pl/plpgsql/src/pl_comp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 0dc0e0b37ed..1d542fd661e 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -285,6 +285,7 @@ do_compile(FunctionCallInfo fcinfo,
int *in_arg_varnos = NULL;
PLpgSQL_variable **out_arg_variables;
MemoryContext func_cxt;
+ PLpgSQL_trigtype fn_is_trigger;
/*
* Setup the scanner input and error info. We assume that this function
@@ -352,11 +353,12 @@ do_compile(FunctionCallInfo fcinfo,
function->resolve_option = plpgsql_variable_conflict;
if (is_dml_trigger)
- function->fn_is_trigger = PLPGSQL_DML_TRIGGER;
+ fn_is_trigger = PLPGSQL_DML_TRIGGER;
else if (is_event_trigger)
- function->fn_is_trigger = PLPGSQL_EVENT_TRIGGER;
+ fn_is_trigger = PLPGSQL_EVENT_TRIGGER;
else
- function->fn_is_trigger = PLPGSQL_NOT_TRIGGER;
+ fn_is_trigger = PLPGSQL_NOT_TRIGGER;
+ function->fn_is_trigger = fn_is_trigger;
/*
* Initialize the compiler, particularly the namespace stack. The
@@ -374,6 +376,7 @@ do_compile(FunctionCallInfo fcinfo,
sizeof(PLpgSQL_datum *) * datums_alloc);
datums_last = 0;
+ Assert(fn_is_trigger == function->fn_is_trigger);
switch (function->fn_is_trigger)
{
case PLPGSQL_NOT_TRIGGER:
@@ -537,9 +540,13 @@ do_compile(FunctionCallInfo fcinfo,
rettypeid == RECORDOID)
/* okay */ ;
else if (rettypeid == TRIGGEROID || rettypeid == EVTTRIGGEROID)
+ {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("trigger functions can only be called as triggers")));
+ errmsg("trigger functions can only be called as triggers"),
+ errhint("CALLED_AS_TRIGGER=%d CALLED_AS_EVENT_TRIGGER=%d",
+ CALLED_AS_TRIGGER(fcinfo), CALLED_AS_EVENT_TRIGGER(fcinfo))));
+ }
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),