[postgis-users] pl/pgsql getting ST_X output as REAL

Jan Saalbach fire at dubmosphere.de
Tue Oct 5 07:12:29 PDT 2010


Hi all,
on my journey to learning PostgreSQL and PostGis I am now trying to  
write a function in pl/pgsql. In this little program I would like to  
determine the frequency of different x-values of POINT3D objects to  
get an idea about how many "rows" were digitized.

Therefore I would like to use the following command:

FOR x_value IN SELECT ST_X(points) FROM table LOOP

The problem is that in the DECLARE-section x_value has to be set to  
type RECORD.

x_value RECORD;

In the course of the program I would like to work with REAL values for  
convenience. How do I go about casting the x_value RECORD, which seems  
to be some kind of string with brackets around the value, to a REAL  
object? Any ideas?

Regards
Jan





More information about the postgis-users mailing list