I am trying to install ubuntuone on a ubuntu server 15.04 and it seems there are a few things that aren't working anymore.
The main problem I have is a query that is failing. Here is how it looks like:
CREATE FUNCTION activity() RETURNS SETOF pg_stat_activity
LANGUAGE sql SECURITY DEFINER
SET search_path TO public
AS $$
SELECT
datid, datname, pid, usesysid, usename,
application_name, client_addr, client_hostname, client_port,
backend_start, xact_start, query_start, waiting,
CASE
WHEN query LIKE '<IDLE>%'
OR query LIKE 'autovacuum:%'
THEN query
ELSE
'<HIDDEN>'
END AS current_query
FROM pg_catalog.pg_stat_activity;
$$;
When I run it I get this error:
ERROR: return type mismatch in function declared to return pg_stat_activity
DETAIL: Final statement returns boolean instead of timestamp with time zone at column 13.
CONTEXT: SQL function "activity"
I understand the error, but I don't know how it is returning a bool. I ran the same query manually and still get the same error. Note that I am not too familiar with postgres so please be detailed.
What part of the query is returning a bool? or is the query correct at all?
Note the application was written for postgresql-9.1 but I am ruing 9.4
