3

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

  • 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 '14 at 8:51
2

Function Execute like this And get my Answer

select * from functionname();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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