@@ -1042,7 +1042,7 @@ void middle_pgsql_t::start(const options_t *out_options_)
1042
1042
{
1043
1043
out_options = out_options_;
1044
1044
int i;
1045
- bool dropcreate = !out_options->append ;
1045
+ bool dropcreate = !out_options->append ; // /< If tables need to be dropped and created anew
1046
1046
1047
1047
ways_pending_tracker.reset (new id_tracker ());
1048
1048
rels_pending_tracker.reset (new id_tracker ());
@@ -1061,7 +1061,7 @@ void middle_pgsql_t::start(const options_t *out_options_)
1061
1061
append = out_options->append ;
1062
1062
// reset this on every start to avoid options from last run
1063
1063
// staying set for the second.
1064
- build_indexes = 0 ;
1064
+ build_indexes = !append && !out_options-> droptemp ;
1065
1065
1066
1066
cache.reset (new node_ram_cache ( out_options->alloc_chunkwise | ALLOC_LOSSY, out_options->cache , out_options->scale ));
1067
1067
if (out_options->flat_node_cache_enabled ) persistent_cache.reset (new node_persistent_cache (out_options, out_options->append , false , cache));
@@ -1089,15 +1089,6 @@ void middle_pgsql_t::start(const options_t *out_options_)
1089
1089
*/
1090
1090
pgsql_exec (sql_conn, PGRES_COMMAND_OK, " SET synchronous_commit TO off;" );
1091
1091
1092
- /* Not really the right place for this test, but we need a live
1093
- * connection that not used for anything else yet, and we'd like to
1094
- * warn users *before* we start doing mountains of work */
1095
- if (i == t_node)
1096
- {
1097
- if (!out_options->append )
1098
- build_indexes = 1 ;
1099
- }
1100
-
1101
1092
pgsql_exec (sql_conn, PGRES_COMMAND_OK, " SET client_min_messages = WARNING" );
1102
1093
if (dropcreate) {
1103
1094
pgsql_exec (sql_conn, PGRES_COMMAND_OK, " DROP TABLE IF EXISTS %s" , tables[i].name );
@@ -1229,7 +1220,7 @@ void middle_pgsql_t::stop(void)
1229
1220
1230
1221
middle_pgsql_t ::middle_pgsql_t ()
1231
1222
: tables(), num_tables(0 ), node_table(nullptr ), way_table(nullptr ), rel_table(nullptr ),
1232
- append (false ), mark_pending(true ), cache(), persistent_cache(), build_indexes(0 )
1223
+ append (false ), mark_pending(true ), cache(), persistent_cache(), build_indexes(true )
1233
1224
{
1234
1225
/* table = t_node,*/
1235
1226
tables.push_back (table_desc (
0 commit comments