from some time I have a very strange problem with my postgresql 9.2.2 64bit. I make a few changes with an plp function:
BEGIN UPDATE table SET X = X where id = aid; UPDATE table_2 SET Y=Y where id = aid; IF aid > 0 THEN SELECT INTO ids id FROM table_3 WHERE x = x; IF aid IS NULL THEN INSERT INTO table_3 (id) VALUES (x); ELSE UPDATE table_3 SET id = id + 1 WHERE x = X; END IF; END IF; RETURN 200; END;