This is because your function is disrupted by design. It should be:
CREATE FUNCTION all_users() RETURNS SETOF users AS
'SELECT * FROM users' LANGUAGE sql STABLE;
Or, alternatively, a more flexible form RETURNS TABLE (...) as @Clodoaldo posted . But itβs usually wiser to use RETURNS SETOF usersto query with SELECT * FROM users.
( ), . , .
SQL Fiddle.
, SELECT:
SELECT (SELECT u from users u).*;
:
id | email
-------+------
<NULL> | <NULL>
: Plain SQL , , .
, .