I have a function created as follows:
CREATE LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION unpickle (data text)
RETURNS text[]
AS $$
import base64
import pickle
return pickle.loads(base64.b64decode(data))
$$ LANGUAGE plpythonu IMMUTABLE;
CREATE INDEX issues_unpickle_tags_index ON issue USING btree (unpickle(tags));
I am getting an error when creating the index as - ERROR: function unpickle(text[]) does not exist.
The structure of table is like this:
CREATE TABLE "issue" (
"id" int4 DEFAULT nextval('issue_id_seq'::regclass) NOT NULL,
"tags" text[] COLLATE "default",
"description" text COLLATE "default" NOT NULL
)
I tried changing the first part to
CREATE OR REPLACE FUNCTION unpickle (data text[])
RETURNS text[]
Then get the error - ERROR: TypeError: must be string or buffer, not list
What am I doing wrong here.