[PL/pgSQL] function call - Mailing list pgsql-general

From Tarlika Elisabeth Schmitz
Subject [PL/pgSQL] function call
Date
Msg-id 20111031133141.1da3c452@dick.coachhouse
Whole thread Raw
Responses Re: [PL/pgSQL] function call  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
I have created a function log_insert(), which is simply a shorthand for
an INSERT table and which I want to call from various trigger functions.

CREATE OR REPLACE FUNCTION log_insert(vseverity text, vtrigger text,
vtriggertable text, vtriggerid text, vmessage text) RETURNS boolean AS
$BODY$
BEGIN
  INSERT INTO log
  (severity, trigger,triggertable, triggerid, message)
  VALUES
  (vseverity, vtrigger,vtriggertable, vtriggerid, vmessage);
END
$BODY$
LANGUAGE plpgsql VOLATILE;


I tried:
log_insert('I', TG_NAME, TG_TABLE_NAME, NEW.id, 'some msg');
=> I get a syntax error on CREATE TRIGGER.

SELECT log_insert(...)
=> passes the syntax check but throws an error when run:
"function log_insert(unknown, unknown, unknown, integer, unknown) does
not exist Hint: No function matches the given name and argument types.
You might need to add explicit type casts."


Any help would be greatly appreciated.
--

Best Regards,
Tarlika Elisabeth Schmitz

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Why is there no 8.3.16 rpm with _id ?
Next
From: Merlin Moncure
Date:
Subject: Re: [PL/pgSQL] function call