Why do function inputs need an extra set on parens in this Postgres function? This works. However, it fails with a syntax error if the "extra" parenthesis in the second function are omitted. Why? 

create function epochSeconds(timestamp) returns int as $$
  select extract(epoch from $1)::int;
$$ language sql;

create function tableRowEpochSeconds(integer) returns int as $$
  select epochSeconds((select max(baz.created) from baz where baz.id = $1));
$$ language sql;


Does not work: 

&lt;same other code&gt;
select epochSeconds(select max(baz.created) from baz where baz.id = $1);
&lt;same other code&gt;
You need the extra parentheses because your function epochseconds() is defined to accept a single value, a select returns a set of rows, the parentheses indicated that the select only returns a single row and column (a scalar value). 

But there is no need for that, just pass the max value directly to the function:

create function tablerowepochseconds(integer) returns int as $$
  select epochseconds(max(baz.created))
  from baz 
  where baz.id = $1;
$$ language sql;