2 of 3 edited tags

Postgresql return table with columns in function

I have this function, it's simple enough.

CREATE OR REPLACE FUNCTION test_function()
RETURNS TABLE(
        id INTEGER,
        organization_id INTEGER,
        email_address CHARACTER VARYING
)
AS $BODY$
        SELECT id, organization_id, email_address FROM users;

$BODY$ LANGUAGE SQL;

The output of this functions gives me something that looks like this:

> SELECT test_function();                                                                                                                                                                                                          test_function 
---------------
 (1,1,test)
 (3,1,test2)
 (4,2,2test)
(3 rows)

When I run the query by itself, I expect to get something more like this:

> select id, organization_id, email_address FROM users;
 id | organization_id | email_address 
----+-----------------+---------------
  1 |               1 | test
  3 |               1 | test2
  4 |               2 | 2test
(3 rows)

How can I get a similar result back like that so I can parse it in a SQL function?