Thread: type cast of function arguments
I have written this little silly function CREATE OR REPLACE FUNCTION recordMail(customerId_ integer, message_ VARCHAR(240)) RETURNS void AS $$ BEGIN INSERT INTO MailRecord (custid,message) VALUES (customerId_, message_); END; $$ LANGUAGE plpgsql; And it is created, and then I do: select recordMail(10,'asd'); and I get ERROR: function recordmail(integer, "unknown") does not exist LINE 1: select recordMail(10,'asd'); ^ HINT: No function matches the given name and argument types. You may need to add explicit type casts. What is wrong here and how do I fix it?
"A B" <gentosaker@gmail.com> writes: > I have written this little silly function > CREATE OR REPLACE FUNCTION recordMail(customerId_ integer, message_ > VARCHAR(240)) RETURNS void AS $$ > BEGIN > INSERT INTO MailRecord (custid,message) VALUES (customerId_, message_); > END; > $$ LANGUAGE plpgsql; > And it is created, and then I do: > select recordMail(10,'asd'); > and I get > ERROR: function recordmail(integer, "unknown") does not exist Copying and pasting this example from your email works fine for me. I speculate that you have a case-folding problem --- did you double-quote the function name when creating it? Another possibility is that you created it in some schema that's not in your search path. regards, tom lane
Oh, I'm so very ashamed of my self. I did \df and didn't find the function in the list. Ohh.. I'm so very embarresd... STUPID me.... I was so very certain that I did run the CREATE command to create the function that it didn't even occur to me that I didn't run it. Well, problem solved.. :-$ Thanks, sorry for bothering you with this.