I am having a little bit of a trouble trying to pull my data through a function I've created in my database (using postgresql + postgis). The case is, whenever I run my query, which can be found in my function via sql, separately, it runs just fine and returns my data.
My function looks like this
CREATE OR REPLACE FUNCTION common.myfunc(string) RETURNS refcursor AS
$BODY$
DECLARE
ref refcursor default 'outrefcursor'
BEGIN
OPEN ref FOR
-- pretty big query here
RETURN ref; END;
$BODY$ LANGUAGE plpgsql VOLATILE
When I run
SELECT common.myfunc(string);
FETCH ALL IN outrefcursor;
It works just fine
However, on my django side when I do
cursor.execute("SELECT * FROM common.myfunc(someString)")
mydata = cursor.fetchall()
it return the default value of the cursor
I'd truly appreciate any help to solve this strange behavior