Commit 33773af9 authored by Tom Lane's avatar Tom Lane

Generate distinct error messages for trigger function not found

and trigger function found but returns wrong type.
parent 443c08a1
...@@ -138,10 +138,12 @@ CreateTrigger(CreateTrigStmt *stmt) ...@@ -138,10 +138,12 @@ CreateTrigger(CreateTrigStmt *stmt)
PointerGetDatum(fargtypes), PointerGetDatum(fargtypes),
0); 0);
if (!HeapTupleIsValid(tuple) || if (!HeapTupleIsValid(tuple) ||
((Form_pg_proc) GETSTRUCT(tuple))->prorettype != 0 ||
((Form_pg_proc) GETSTRUCT(tuple))->pronargs != 0) ((Form_pg_proc) GETSTRUCT(tuple))->pronargs != 0)
elog(ERROR, "CreateTrigger: function %s () does not exist", stmt->funcname); elog(ERROR, "CreateTrigger: function %s() does not exist",
stmt->funcname);
if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != 0)
elog(ERROR, "CreateTrigger: function %s() must return OPAQUE",
stmt->funcname);
if (((Form_pg_proc) GETSTRUCT(tuple))->prolang != ClanguageId) if (((Form_pg_proc) GETSTRUCT(tuple))->prolang != ClanguageId)
{ {
HeapTuple langTup; HeapTuple langTup;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment