Estoy usando una función PL / pgSQL en PostgreSQL 9.3 con varias consultas complejas dentro: create function f1() returns integer as $$ declare event tablename%ROWTYPE; .... .... begin FOR event IN SELECT * FROM tablename WHERE condition LOOP EXECUTE 'SELECT f2(event.columnname)' INTO...