[postgis-users] CTE example

Shira Bezalel shira at sfei.org
Tue Mar 5 12:07:03 PST 2013


Hi Patrick, 


I ran into this same problem not too long ago. I got it to work with minor changes in the syntax of the 3rd CTE before the final select statement like so: 


grid AS -- Define CTE to store our grid that uses usext and grid_dim 
(SELECT ST_SetSRID(ST_MakeBox2d(ST_Point(xmin + (a - 1)*g_width, ymin + (b-1)*g_height), 
ST_Point(xmin + a*g_width, ymin + b*g_height)), 3310) As grid_geom 
FROM 
(SELECT generate_series(1,x_gridcnt) as a FROM usext) As x CROSS JOIN 
(SELECT generate_series(1,y_gridcnt) as b FROM usext) As y CROSS JOIN 
grid_dim) 


Of course, I think Regina/Leo are probably the one to confirm if my changes are OK. 

Shira 


--
Shira Bezalel
Database & Systems Manager
San Francisco Estuary Institute
4911 Central Ave
Richmond CA 94804 
Ph: 510-746-7304
Fax: 510-746-7300



----- Original Message ----- 

From: "Patrick Browne" <patrickcbbrowne at gmail.com> 
To: postgis-users at lists.osgeo.org 
Sent: Tuesday, March 5, 2013 11:52:57 AM 
Subject: [postgis-users] CTE example 


I am trying to run the CTE example on slide 22 from http://www.postgis.us/downloads/oscon2009_PostGISTips.pdf 

When I paste the example into the SQL-shell I get the following error: 

ERROR: operator does not exist: record - integer LINE 14: ... x, y, ST_SetSRID(ST_MakeBox2d(ST_Point(xmin + (x - 1)*g_wid... HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts 

I am using POSTGIS 1.4.1 with Postgres 8.4 I used the data that accompany the slides. 


Any advice will be much appreciated. 


_______________________________________________ 
postgis-users mailing list 
postgis-users at lists.osgeo.org 
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users 


More information about the postgis-users mailing list