Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Postgres Functions

Status
Not open for further replies.

Stedo

Programmer
Sep 15, 2005
44
0
0
SE
hi,

I've just started using postgres and I want to create Stored Procedures. So I have created a Function with no parameters which returns an int8. However when I try to call the function I get a 'can't find function' error. Even although I can clearly see the function in the database. Have I missed something??
 
show what you have done: the function, and how do you invoke it

otherwise we have to guess what have you done
 
hi,

Here's the function:


CREATE FUNCTION public.TestFunction () RETURNS bool AS
'
SELECT true;

'
LANGUAGE 'sql'
GO

And I call it using...

SELECT public.TestFunction()
GO

...but it doesn't appear to find the function.

Thanks
Steve
 
what environment are you using (this GO is a little strange to me), here is what I get from the command line client psql

test=# CREATE FUNCTION public.TestFunction () RETURNS bool AS
test-# '
test'# SELECT true;
test'#
test'# '
test-# LANGUAGE 'sql';
CREATE FUNCTION
test=# SELECT public.TestFunction();
testfunction
--------------
t
(1 row)


(there are two ; that I added)
 
hi,

When I try to run the...

SELECT public.TestFunction();

I get an error message which says ' The function public.testfunction() does not exist'.

This is really odd as I see that it does exist!!!

Thanks
Stephen
 
very strange

aren't there any no error messages when creating the function?
 
hi,

No errors when creating the function, that's the weird thing. Everything looks as if it's okay, only it doesn't find the function? There is nothing special to configure in the database or anything is there?

Thanks
Steve
 
hi,

After a lot of weirdness it has started working! Whey Hey! Can tell you how but it seems to going fine now.

Thanks
Steve
 
Could be a casefolding thing. Postgresql tends to make fold stuff to lowercase, unless enclosed in doublequotes (grasping at the dusty, cobwebbed filled corners of my aging memory here, I'm up for correction :)).

----
JBR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top