2013-03-05 75 views
0

我试图从 http://www.postgis.us/downloads/oscon2009_PostGISTips.pdf问题在PostGIS CTE

当我粘贴在SQL壳我得到以下错误的例子幻灯片22运行with-as例如:

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

我使用POSTGIS 1.4.1Postgres 8.4 我用伴随滑动的数据 http://www.bostongis.com/downloads/oscon2009/oscon2009_src.zip

我一个也试图从网络的状态数据:

shp2pgsql -s 2163 statesp020.shp public.states > states.sql 
psql -U postgres -d postgis -f states.sql 

但得到了同样的错误。 任何意见将不胜感激。

回答

0

错误“记录 - 整数”(x - 1)可以通过从generate_series给出结果预期的别名xy被固定。找到这个部分:

... 
(SELECT generate_series(1,x_gridcnt) FROM usext) As x CROSS JOIN 
(SELECT generate_series(1,y_gridcnt) FROM usext) As y CROSS JOIN 
... 

其中xy值居然叫x.generate_seriesy.generate_series

更改为:

... 
(SELECT generate_series(1,x_gridcnt) As x FROM usext) As x CROSS JOIN 
(SELECT generate_series(1,y_gridcnt) As y FROM usext) As y CROSS JOIN 
... 

,他们现在被称为x.xy.y,或暗示刚刚xy