Postgresql – How to create Select query function in the Postgresql

postgresql

I want create select function in postgres and get all data from table. I many example see and try but not perfact execute function. What perfact syntax for select query function create in postgres?

My function code.

    CREATE OR REPLACE FUNCTION dataget()
  RETURNS SETOF tbuserlogin AS
$BODY$BEGIN

RETURN QUERY  SELECT * FROM  tbuserlogin;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION dataget()
  OWNER TO postgres;

This function execute and show the datatable record but this display record not proper column wise but only one function column display.
Like this

Thanks.
enter image description here

Best Answer

Function Execute like this And get my Answer

select * from functionname();