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
-
2Is this homework? That function is malformed in such a contrived way that it seems like it must've been done on purpose.Craig Ringer– Craig Ringer2014年01月23日 08:51:36 +00:00Commented Jan 23, 2014 at 8:51
1 Answer 1
Function Execute like this And get my Answer
select * from functionname();