SQL function which returns true/false depending on success of insert query
One way with little noise in the code:

create function test()
  returns boolean as
$$
   WITH ins AS (
      insert into    ...
      select         ...
      from           ...
      where          ...
      returning      true
      )
   SELECT true FROM ins
   UNION ALL SELECT false;
$$
language sql volatile;


The function, being declared as returns boolean (and not returns setof boolean) returns only the first row. If no INSERT happens, the first (and only) row delivers false.

Or, a shorter version of your first variant:

...
   WITH ins AS (
      insert into    ...
      )
   SELECT EXISTS(TABLE ins)
...


See:


Is there a shortcut for SELECT * FROM?


Related (with alternatives):


How to return a value from a function if no value is found


Quoting the manual to clarify the behavior of SQL functions:


  SQL functions execute an arbitrary list of SQL statements, returning
  the result of the last query in the list. In the simple (non-set)
  case, the first row of the last query's result will be returned. (Bear
  in mind that “the first row” of a multirow result is not well-defined
  unless you use ORDER BY.) If the last query happens to return no rows
  at all, the null value will be returned.


Bold emphasis mine.

Note: the above is a single query. And we don't need ORDER BY, since a plain UNION ALL without more operations in the outer query level simply appends the resulting row to the set in last position.