]> git.openstreetmap.org Git - nominatim.git/commitdiff
fix setup when no us_postcode is available
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 5 Jan 2018 21:41:05 +0000 (22:41 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 5 Jan 2018 21:41:05 +0000 (22:41 +0100)
utils/setup.php

index c6cc7773dfdef7f119db162f94570fea80681fce..8988fc519d2dd374f1a4ca930523121bf1da6f9c 100755 (executable)
@@ -540,10 +540,8 @@ if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
         $sSQL .= '  FROM us_postcode WHERE postcode NOT IN';
         $sSQL .= '        (SELECT postcode FROM location_postcode';
         $sSQL .= "          WHERE country_code = 'us')";
-    } else {
-        $sSQL .= 'TRUNCATE TABLE us_postcode';
+        if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
     }
-    if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
 
     // add missing postcodes for GB (if available)
     $sSQL  = 'INSERT INTO location_postcode';