I need to make a select query with joins. This should be written in a function. My approach didn't work:
CREATE OR REPLACE FUNCTION test2()
RETURNS SETOF record AS'
DECLARE
r record;
BEGIN
for r in SELECT * FROM messages_wall INNER JOIN location ON
messages_wall.id = location.id
loop
return next r;
end loop;
end; '
LANGUAGE 'plpgsql'
ERROR: a column definition list is required for functions returning "record"
I should call this function from a .net application. How should I proceed?