Using Postgres param in a function
You are adding both Timestamp and a in extract function, just remove TIMESTAMP
create function tz_to_double(a timestamp) returns DOUBLE PRECISION as $$
    SELECT EXTRACT(EPOCH FROM  a);
$$ language sql;