Is it possible to return a SETOF text or a text[] from pl/python?
I've got the following test cases:
CREATE OR REPLACE FUNCTION arf()
RETURNS text[] LANGUAGE plpythonu AS
$$return [one, two, three]$$;
SELECT arf();
ERROR: missing dimension value
CREATE OR REPLACE FUNCTION arf2()
RETURNS
Peter Fein wrote:
Is it possible to return a SETOF text or a text[] from pl/python?
I've got the following test cases:
CREATE OR REPLACE FUNCTION arf()
RETURNS text[] LANGUAGE plpythonu AS
$$return [one, two, three]$$;
SELECT arf();
ERROR: missing dimension value
CREATE OR REPLACE FUNCTION
Joshua D. Drake wrote:
Peter Fein wrote:
Is it possible to return a SETOF text or a text[] from pl/python?
I've got the following test cases:
CREATE OR REPLACE FUNCTION arf()
RETURNS text[] LANGUAGE plpythonu AS
$$return [one, two, three]$$;
SELECT arf();
ERROR: missing dimension
I am not an everyday python programmer but I am pretty sure that you are
trying to return a list in arf(). You can't return a list you have to
return the array type which is why arf2 works.
Ok. How does one convert a python list to a PGSql array then? Is there
a better way to do it than
Joshua D. Drake wrote:
You would actually have to have a set. What I believe you are trying to
do is transform a list to a result set. I don't think you can do that
without some additional programming within the function.
Somebody may know of a better way but what I would think would happen
Joshua D. Drake wrote:
Somebody may know of a better way but what I would think would happen is
this:
Break up list, insert each value of list into a temp table as a row,
return set of temp table.
Ok. I tried this ran in to some trouble:
CREATE OR REPLACE FUNCTION setret(text)
RETURNS