Решением, которое я нашел, было использование join:
create table tmp (a int, b int, c int);
insert into tmp (a,b,c) values (1,2,3), (3,4,5), (5,12,13);
create type ispyth3 as (is_it boolean, perimeter int);
create function check_it(int, int, int) returns ispyth3 as $$
begin
return ($1*$1 + $2*$2 = $3*$3, $1+$2+$3);
end
$$ language plpgsql;
select * from tmp join check_it(a,b,c) on 1=1;
Возвращает:
a | b | c | is_it | perimeter
---+----+----+-------+-----------
1 | 2 | 3 | f | 6
3 | 4 | 5 | t | 12
5 | 12 | 13 | t | 30
(3 rows)