I'm very new in postgresql. I read many posts in this questions, but still don't get correct answer in my simple problem and keep receiving syntax error. I'm trying declare new string variable named parents_d and in the following lines trying to assign new value as well. Please help me!
CREATE OR REPLACE FUNCTION retrieve_parents(cid integer) RETURNS text AS $$
BEGIN
DECLARE pd text;
pd:= 'function';
RETURN concat(cid,pd);
END;
$$ LANGUAGE plpgsql;
ERROR: duplicate declaration at or near "pd" LINE 4: pd:= 'function'; ^
********** Error **********
ERROR: duplicate declaration at or near "pd" SQL state: 42601 Character: 104