0

I have 3 pgRouting sql files,

  • routing_core
  • routing_core_wrappers
  • routing_topology

And I run the code in the first one in PostgreSQL 9.2, I got this error,

enter image description here

PS. although there are already pgRouting functions in extensions of 9.2, I still can't run the following code,

ALTER TABLE tc_2000_w_area ADD COLUMN source integer;
ALTER TABLE tc_2000_w_area ADD COLUMN target integer;
SELECT assign_vertex_id('tc_2000_w_area', 0.0001, 'the_geom', 'gid')

got the error,

>>> 

Traceback (most recent call last):
  File "C:/Users/Heinz/Desktop/python_test/any_test.py", line 12, in <module>
    cur.execute(query)
ProgrammingError: 錯誤:  函式 assign_vertex_id(unknown, numeric, unknown, unknown) 不存在
LINE 4:     SELECT assign_vertex_id('tc_2000_w_area', 0.0001, 'the_g...
                   ^
HINT:  沒有符合指定之名稱和參數型別的函式。您可能需要加入明確型別轉換。

So I think to run the above 3 sql files first.

But I can run all 3 sql files in PostgreSQL 8.4

I am working with PostgreSQL 9.2, PostgreSQL 8.4 under Windows 8.1 x64.


UPDATE#1

I run the code below, but shows error message,

create extension pgrouting;

錯誤:  擴充功能 "pgrouting" 已存在

********** 錯誤 **********

錯誤: 擴充功能 "pgrouting" 已存在
SQL 狀態: 42710

the error message means the pgRouting extension already exists, but if I directly use the code in my original post, got the same error as I posted.

Heinz
  • 2,415
  • 6
  • 26
  • 34

1 Answers1

0

You have to install postgis before pgrouting.

create extension postgis;

create extension pgrouting;

Then you should be able to use it.

Stephen Woodbridge
  • 1,100
  • 1
  • 8
  • 16