[postgis-users] Ultimate solution to assign_vertex_id() error bug :-)
于龙振
realylz at 126.com
Tue Oct 4 16:43:19 PDT 2011
Description:
CREATE TABLE will create implicit sequence "vertices_tmp_id_seq" for serial column "vertices_tmp.id" CONTEXT: SQL statement "CREATE TABLE vertices_tmp (id serial)" PL/pgSQL function "assign_vertex_id" line 21 at EXECUTE statementERROR: relation "baharestan.roads" does not exist CONTEXT: SQL statement "SELECT count(*) as countids FROM "baharestan.roads"" PL/pgSQL function "assign_vertex_id" line 28 at FOR over EXECUTE statement
sorry for my poor english:
I read plpgsql program of assign_vertex_id in pgAdminIII and find a bug,there are three lines like followed:
...
FOR _r IN EXECUTE 'SELECT srid FROM geometry_columns WHERE f_table_name='''|| quote_ident(geom_table)||''';' LOOP
srid := _r.srid;
END LOOP;
...
there is something wrong with "quote_ident(tablename)",this command will add " around tablename, just like quote_ident(tablename) <=> "tablename"
However, the above condition, program should modified to:
...
FOR _r IN EXECUTE 'SELECT srid FROM geometry_columns WHERE f_table_name='''|| geom_table||''';' LOOP
srid := _r.srid;
END LOOP;
...
that's because there are ' around tablename, there will be error with '"tablename"' instead of 'tablename'.
ok! with above the little modification, there will be no error with assign_vertex_id() :-)
I'think there maybe someother similar error because of the quote_ident. I'm thankful for your hardship!
YuLongzhen
266061 Qingdao, China.
realylz at 126.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111005/3a4fe7c5/attachment.html>
More information about the postgis-users
mailing list