I would like to write a PostgreSQL stored function that essentially behaves like the stored procedures I know and love from MSSQL and MySQL where I can just wrap a query that takes no parameters and have it return that resultset without having to specify the format of the output and change that definition every time I update the query. Is this even possible in PostgreSQL ?
I've tried the following using PostgreSQL 9.2:
CREATE OR REPLACE FUNCTION test() RETURNS SETOF record
Which gives me the following error:
ERROR: a column definition list is required for functions returning "record"
I've also tried:
CREATE OR REPLACE FUNCTION test() RETURNS table ()
but apparently that's invalid syntax.