<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19394"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>Hello,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>Maybe you should try to write the end of your funtion 
like this :</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>return query</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>    your query</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>return;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
class=423430215-04022013>Hugues.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV><BR>
<DIV dir=ltr lang=fr class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> postgis-users-bounces@lists.osgeo.org 
[mailto:postgis-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>tasha 
dewasi<BR><B>Sent:</B> Monday, February 04, 2013 1:57 PM<BR><B>To:</B> PostGIS 
Users Discussion<BR><B>Subject:</B> [postgis-users] Postgresql create 
function<BR></FONT><BR></DIV>
<DIV></DIV>hello,
<DIV>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</DIV>
<DIV>I don't understand whats wrong.</DIV>
<DIV>Please guide me</DIV>
<DIV><BR></DIV>
<DIV>here's my code:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>CREATE or REPLACE FUNCTION DEMO(latitude double precision, longitude double 
precision)</DIV>
<DIV>RETURNS TABLE (Tmsgcount bigint,utc_time double precision) as $$</DIV>
<DIV>BEGIN</DIV>
<DIV><BR></DIV>
<DIV>create temporary table Transmitter as select count(msgno) 
TransCount,floor(utc_time) Trans_time from transmitter_primary where </DIV>
<DIV>st_dwithin(st_geogfromtext('SRID=4326;POINT(' || longitude || ' ' || 
latitude || ')'),geog,10)='t' group by floor(utc_time) order by 
floor(utc_time);</DIV>
<DIV><BR></DIV>
<DIV>RETURN QUERY select * from Transmitter;</DIV>
<DIV><BR></DIV>
<DIV>END;</DIV>
<DIV>$$ LANGUAGE plpgsql;</DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>and it returns me just this value</DIV>
<DIV>13034;</DIV></BODY></HTML>