Can anyone tell me why does not insert this function anything into the table?
CREATE OR REPLACE FUNCTION insert_one(_temp VARCHAR(1000))
RETURNS void AS $$
DECLARE
TEMP INT := NULL;
BEGIN
SELECT "temptable"."id" INTO TEMP FROM "temptable" WHERE "tmpstr" = _temp;
IF TEMP IS NULL THEN
INSERT INTO "temptable"("tmpstr") values(_temp);
SELECT CURRVAL("id") FROM "temptable" INTO TEMP;
END IF;
END;
$$ LANGUAGE plpgsql;