Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e2ff6e

Browse files
committed
Add a check for trigger function with declared arguments. This path
could not be reached before, but now that there is a plpgsql validatorfunction, it can be. Check is needed to prevent core dump reported bySatoshi Nagayasu. Besides, this gives a more specific and usefulerror message for a fairly common novice error.
1 parent99382f4 commit6e2ff6e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* procedural language
44
*
55
* IDENTIFICATION
6-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.91 2005/06/10 16:23:11 neilc Exp $
6+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.92 2005/07/06 16:42:10 tgl Exp $
77
*
88
* This software is copyrighted by Jan Wieck - Hamburg.
99
*
@@ -547,6 +547,13 @@ do_compile(FunctionCallInfo fcinfo,
547547
function->fn_retistuple= true;
548548
function->fn_retset= false;
549549

550+
/* shouldn't be any declared arguments */
551+
if (procStruct->pronargs!=0)
552+
ereport(ERROR,
553+
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
554+
errmsg("trigger functions cannot have declared arguments"),
555+
errhint("You probably want to use TG_NARGS and TG_ARGV instead.")));
556+
550557
/* Add the record for referencing NEW */
551558
rec=palloc0(sizeof(PLpgSQL_rec));
552559
rec->dtype=PLPGSQL_DTYPE_REC;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp