diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-06 16:42:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-06 16:42:10 +0000 |
commit | 6e2ff6e89aed651ec8b051dee4f65aa5224d1119 (patch) | |
tree | 2a97b8353aea30d8260b386a94bf1a009fc57ac5 /src | |
parent | 99382f45815d2720196e6d2510391d5781d0f46c (diff) | |
download | postgresql-6e2ff6e89aed651ec8b051dee4f65aa5224d1119.tar.gz postgresql-6e2ff6e89aed651ec8b051dee4f65aa5224d1119.zip |
Add a check for trigger function with declared arguments. This path
could not be reached before, but now that there is a plpgsql validator
function, it can be. Check is needed to prevent core dump reported by
Satoshi Nagayasu. Besides, this gives a more specific and useful
error message for a fairly common novice error.
Diffstat (limited to 'src')
-rw-r--r-- | src/pl/plpgsql/src/pl_comp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index 38b3d077de2..d3557ca5805 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.91 2005/06/10 16:23:11 neilc Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.92 2005/07/06 16:42:10 tgl Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -547,6 +547,13 @@ do_compile(FunctionCallInfo fcinfo, function->fn_retistuple = true; function->fn_retset = false; + /* shouldn't be any declared arguments */ + if (procStruct->pronargs != 0) + ereport(ERROR, + (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), + errmsg("trigger functions cannot have declared arguments"), + errhint("You probably want to use TG_NARGS and TG_ARGV instead."))); + /* Add the record for referencing NEW */ rec = palloc0(sizeof(PLpgSQL_rec)); rec->dtype = PLPGSQL_DTYPE_REC; |