[postgis-users] Postgresql create function

tasha dewasi tasneem.europe at gmail.com
Mon Feb 4 04:57:19 PST 2013


hello,
I am trying to create a function, but instead of returning me all the rows
from a table, it is just returning me count of rows
I don't understand whats wrong.
Please guide me

here's my code:

CREATE or REPLACE FUNCTION DEMO(latitude double precision, longitude double
precision)
RETURNS TABLE (Tmsgcount bigint,utc_time double precision) as $$
BEGIN

create temporary table Transmitter as select count(msgno)
TransCount,floor(utc_time) Trans_time from transmitter_primary where
st_dwithin(st_geogfromtext('SRID=4326;POINT(' || longitude || ' ' ||
latitude || ')'),geog,10)='t' group by floor(utc_time) order by
floor(utc_time);

RETURN QUERY select * from Transmitter;

END;
$$ LANGUAGE plpgsql;


and it returns me just this value
13034;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130204/0a1e9237/attachment.html>


More information about the postgis-users mailing list