@@ -90,6 +90,7 @@ Main Options:
9090 -c|--create Run in create mode (default)
9191 -S|--style=FILE The Lua config file (required, same as for osm2pgsql)
9292 -j|--jobs=NUM Number of parallel jobs (default 1)
93+ --middle-schema=SCHEMA Database schema for middle tables
9394
9495Help/Version Options:
9596 -h|--help Print this help text and stop
@@ -125,6 +126,7 @@ static std::array<option, 20> const long_options = {
125126 {" log-level" , required_argument, nullptr , ' l' },
126127 {" style" , required_argument, nullptr , ' S' },
127128 {" log-sql" , no_argument, nullptr , 201 },
129+ {" middle-schema" , required_argument, nullptr , 202 },
128130 {nullptr , 0 , nullptr , 0 }}};
129131
130132struct tile_extent
@@ -583,6 +585,7 @@ int main(int argc, char *argv[])
583585{
584586 try {
585587 database_options_t database_options;
588+ std::string schema{" public" };
586589 std::string log_level;
587590 std::string style;
588591 uint32_t jobs = 1 ;
@@ -594,7 +597,7 @@ int main(int argc, char *argv[])
594597 while (-1 != (c = getopt_long (argc, argv, short_options,
595598 long_options.data (), nullptr ))) {
596599 switch (c) {
597- case ' h' :
600+ case ' h' : // --help
598601 show_help ();
599602 return 0 ;
600603 case ' a' : // --append
@@ -622,19 +625,27 @@ int main(int argc, char *argv[])
622625 case ' P' : // --port
623626 database_options.port = optarg;
624627 break ;
625- case ' l' :
628+ case ' l' : // --log-level
626629 log_level = optarg;
627630 break ;
628- case ' S' :
631+ case ' S' : // --style
629632 style = optarg;
630633 break ;
631- case ' V' :
634+ case ' V' : // --version
632635 log_info (" osm2pgsql-gen version {}" , get_osm2pgsql_version ());
633636 canvas_t::info ();
634637 return 0 ;
635- case 201 :
638+ case 201 : // --log-sql
636639 get_logger ().enable_sql ();
637640 break ;
641+ case 202 : // --middle-schema
642+ schema = optarg;
643+ if (schema.empty ()) {
644+ log_error (" Schema must not be empty" );
645+ return 2 ;
646+ }
647+ check_identifier (schema, " --middle-schema" );
648+ break ;
638649 default :
639650 log_error (" Unknown argument" );
640651 return 2 ;
@@ -696,7 +707,7 @@ int main(int argc, char *argv[])
696707 init_database_capabilities (db_connection);
697708 }
698709
699- properties_t properties{conninfo, " " };
710+ properties_t properties{conninfo, schema };
700711 properties.load ();
701712
702713 bool const updatable = properties.get_bool (" updatable" , false );
0 commit comments