1

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?

IT_info
  • 707
  • 4
  • 16
  • 36

2 Answers2

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.

ylka
  • 293
  • 8
  • 14
  • Welcome to So, I would advice you to add relevant details from the link to your answer, so even if the linked article gets removed in future your answer will still be helpful. – akjoshi Jan 10 '13 at 12:13
  • Thanks akjoshi, I haven't thought of that. – ylka Jan 10 '13 at 12:40
0

Maybe you should try:

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

GIYF

Community
  • 1
  • 1
wildplasser
  • 43,142
  • 8
  • 66
  • 109