OK, I have no idea what's going on. I'm using a Mac and successfully installed pgRouting. I used osm2po on some data, which created a sql file. I imported the sql file into a pgRouting database and all is well, except the fact I only took into account routes for cars.

After Carsten helped me with configuring osm2po.config, I ran osm2po again that ran as expected.

From the terminal, I run the command:

psql -U [username] -d [dbname] -q -f "/Users/John/Desktop/osm2po-4.6.9/wmCar/wmCar/wmCar_2po_4pgr.sql

I was expecting it to be successful like last time, as to my knowledge the conditions are the same. However I get the error:

psql:/Users/John/Desktop/osm2po-4.6.9/wmCar/wmCar_2po_4pgr.sql:101739: ERROR:  INSERT has more expressions than target columns
LINE 2: ..., -2.0046492, 52.5307149, -2.0026647, 52.5310823, >'010200002...

With pgAdmin I look at the empty table that was created, and compared to the first sql file I imported, the new table was missing a column. That being geom_way. I find this odd as I haven't changed anything. I threw osm2po folder to the trash, and unzipped a new osm2po folder. To test whether it was going to work, I ran osm2po on the original pbf file with the original osm2po.config settings and tried to import that into the same pgRouting database. The error appeared again. For some reason, the last column, geom_way, isn't being added to the table.

Would anyone know why it's started doing this?

4 Answers 4


Just a guess. Did you use an uppercase letter in osm2po prefix name? It looks like yes - try to rename prefix/table name from "wmCar_2po_4pgr" to "wmcar_2po_4pgr". It helped me in similar situation - error while loading osm2po routing sql-script into PostgreSQL

  • I see, allowing uppercase prefixes cause lots of trouble in PostGIS. Once again: I will fix it in my next version. Promised.
    – Carsten
    Mar 7, 2013 at 9:25

You have may have to call create extension postgis again if this is not caused by uppercase prefix for you, because 'AddGeometryColumn' requires postgis and if it fails to run, the error will look the same on insert.


This error is known to me. But don't ask me what the intrinsic reason is. It occurs once and then never again. It has sth. to do with the new table column "osm_meta" introduced in Version 4.6.9.

Delete your wmCar_2po_4pgr table manually and try again.

  • The error keeps occuring and can't get past it :/
    – John Bale
    Feb 4, 2013 at 19:05
  • If deleting the table and re-running the sql script fixes it, then the sql script probably has a CREATE TABLE IF NOT EXISTS statement, so if the table exists it skips on to the next step. By deleting the table the CREATE TABLE step is run and you get the table with all the new fields defined. Feb 4, 2013 at 19:08
  • The only get around is to run the script once, with the fail, manually add the geom_way column, edit the sql file and remove DROP and CREATE table code and then run the script again.
    – John Bale
    Feb 4, 2013 at 19:22
  • How did you delete it? Use SELECT DropGeometryTable('wmCar_2po_4pgr'); instead of Drop Table.
    – Carsten
    Feb 4, 2013 at 19:27
  • Another idea: Do you have a depending object on it? Is there a linked view which prevents the script from deleting the table?
    – Carsten
    Feb 4, 2013 at 19:35

Maybe it helps someone, I had tried to run the script by setting a schema in a bash file with SET SCHEMA. The file created by osm2po writes to the public schema, which then caused the import to fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.