Custom Functions
1, the query function:
select prosrc from pg_proc where proname = 'test' test as a function name.
2, delete function:
drop function test (anyelement, anyelement, numeric) test as a function name.
3, the definition of database functions:
create or replace function calculate_speed(end_time anyelement,begin_time anyelement,length numeric) RETURNS numeric as
$$
declare
total_second numeric;
begin
select extract(epoch from((end_time::timestamp - begin_time)))/3.6 into total_second;
return round(length::numeric/total_second::numeric,3);
end;
$$ LANGUAGE plpgsql;