From f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 9 Apr 2002 20:35:55 +0000 Subject: Functions live in namespaces. Qualified function names work, eg SELECT schema1.func2(...). Aggregate names can be qualified at the syntactic level, but the qualification is ignored for the moment. --- src/backend/commands/trigger.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/backend/commands/trigger.c') diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index c05b2ec51a3..72f13d3db49 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.111 2002/04/01 22:36:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.112 2002/04/09 20:35:48 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,7 @@ #include "commands/trigger.h" #include "executor/executor.h" #include "miscadmin.h" +#include "parser/parse_func.h" #include "utils/acl.h" #include "utils/builtins.h" #include "utils/fmgroids.h" @@ -163,18 +164,19 @@ CreateTrigger(CreateTrigStmt *stmt) * Find and validate the trigger function. */ MemSet(fargtypes, 0, FUNC_MAX_ARGS * sizeof(Oid)); - tuple = SearchSysCache(PROCNAME, - PointerGetDatum(stmt->funcname), - Int32GetDatum(0), - PointerGetDatum(fargtypes), - 0); + funcoid = LookupFuncName(stmt->funcname, 0, fargtypes); + if (!OidIsValid(funcoid)) + elog(ERROR, "CreateTrigger: function %s() does not exist", + NameListToString(stmt->funcname)); + tuple = SearchSysCache(PROCOID, + ObjectIdGetDatum(funcoid), + 0, 0, 0); if (!HeapTupleIsValid(tuple)) elog(ERROR, "CreateTrigger: function %s() does not exist", - stmt->funcname); + NameListToString(stmt->funcname)); if (((Form_pg_proc) GETSTRUCT(tuple))->prorettype != 0) elog(ERROR, "CreateTrigger: function %s() must return OPAQUE", - stmt->funcname); - funcoid = tuple->t_data->t_oid; + NameListToString(stmt->funcname)); funclang = ((Form_pg_proc) GETSTRUCT(tuple))->prolang; ReleaseSysCache(tuple); -- cgit v1.2.3