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.
-
1I added the feature request to osm2pgroutingVicky– Vicky2015年07月18日 12:55:31 +00:00Commented Jul 18, 2015 at 12:55
-
@Vicky that's great! I much appreciate that!!!Inactivated Account– Inactivated Account2015年07月18日 15:27:35 +00:00Commented Jul 18, 2015 at 15:27
1 Answer 1
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
-
that's great - worked like a charm. Barring the feature request now in osm2pgrouting, this is a great workaround...thanks again!Inactivated Account– Inactivated Account2015年08月21日 17:13:02 +00:00Commented Aug 21, 2015 at 17:13
-
1BTW I recently added the schema feature in osm2pgrouitng. So should show in next release. github.com/pgRouting/osm2pgrouting/tree/with-schemaRegina Obe– Regina Obe2015年08月21日 18:16:42 +00:00Commented Aug 21, 2015 at 18:16