Assign_vertex_id function

爱⌒轻易说出口 提交于 2019-12-08 08:55:52

问题


When I execute the following query;

SELECT Assign_vertex_id('ways', 0.00001, 'the_geom', 'gid')

I am getting the following error;

NOTICE:  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 15 at EXECUTE statement
    ERROR:  query string argument of EXECUTE is null
    CONTEXT:  PL/pgSQL function "assign_vertex_id" line 32 at EXECUTE statement

    ********** Error **********

    ERROR: query string argument of EXECUTE is null
    SQL state: 22004
    Context: PL/pgSQL function "assign_vertex_id" line 32 at EXECUTE statement

Any idea why is this happening?


回答1:


I know this is an old post, but I would like to provide an answer, maybe it would help someone.

I have found this article, which solved my problem.

UPDATE:

So I copy the relevant information from the article here:

The first line of the following code is wrong:

FOR _r IN EXECUTE 'SELECT srid FROM geometry_columns WHERE f_table_name='''|| quote_ident(geom_table)||''';' LOOP
srid := _r.srid;
    END LOOP;

And should be modified to:

FOR _r IN EXECUTE 'SELECT srid FROM geometry_columns WHERE f_table_name='''|| geom_table||''';' LOOP
srid := _r.srid;
    END LOOP;

It is because "quote_ident(tablename)" is wrong, it adds an extra ' ' around the tablename.




回答2:


Maybe you should try:

SELECT assign_vertex_id("ways", 0.00001, "the_geom", "gid");

GIYF



来源:https://stackoverflow.com/questions/12333251/assign-vertex-id-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!