Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

share|improve this question
2  
Is this homework? That function is malformed in such a contrived way that it seems like it must've been done on purpose. –  Craig Ringer Jan 23 at 8:51
add comment

1 Answer

up vote 2 down vote accepted

Function Execute like this And get my Answer

select * from functionname();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.