0

Is it possible to set the target database schema using osm2pgrouting?

After some debate and troubleshooting, I've decided to host my OSM-based pgRouting data in the same database as the rest of my data, but want to use a different schema (one big issue was using dblink, which I can't get to work anyway).

However, osm2pgrouting doesn't expose the ability to specify the target schema.

asked Jul 17, 2015 at 19:50
2
  • 1
    I added the feature request to osm2pgrouting Commented Jul 18, 2015 at 12:55
  • @Vicky that's great! I much appreciate that!!! Commented Jul 18, 2015 at 15:27

1 Answer 1

2

Only way I've been able to do it (I think it works for osm2pgrouting, but haven't tried recently)

Is to first change the search_path of your database temporarily so preferred schema is first:

ALTER DATABASE yourdb SET search_path = osm_data, public;

Then run osm2pgrouting

Alternatively you could create a user specifically for loading and then set the search_path for that user (or name the same as the schema) assuming you didn't mess with your db search_path.

ALTER ROLE osm_user IN DATABASE yourdb
 SET search_path = osm_data,public;

then always load with that user.

It's not ideal I know. Probably worthwhile putting in a feature request here: https://github.com/pgRouting/osm2pgrouting

answered Jul 18, 2015 at 7:56
2
  • that's great - worked like a charm. Barring the feature request now in osm2pgrouting, this is a great workaround...thanks again! Commented Aug 21, 2015 at 17:13
  • 1
    BTW I recently added the schema feature in osm2pgrouitng. So should show in next release. github.com/pgRouting/osm2pgrouting/tree/with-schema Commented Aug 21, 2015 at 18:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.