]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/export.c
Merge pull request #767 from manzari/patch-1
[nominatim.git] / nominatim / export.c
index 8051c183ddd18183379a0313afa6f51500d2013c..467b3c8cb0f51489d98fd8df74714f2480aadafa 100644 (file)
@@ -121,7 +121,7 @@ void nominatim_export(int rank_min, int rank_max, const char *conninfo, const ch
                 PQclear(resPlaces);
                 exit(EXIT_FAILURE);
             }
                 PQclear(resPlaces);
                 exit(EXIT_FAILURE);
             }
-            if (PQftype(resPlaces, 0) != PG_OID_INT4)
+            if (PQftype(resPlaces, 0) != PG_OID_INT8)
             {
                 fprintf(stderr, "Place_id value has unexpected type\n");
                 PQclear(resPlaces);
             {
                 fprintf(stderr, "Place_id value has unexpected type\n");
                 PQclear(resPlaces);
@@ -131,7 +131,7 @@ void nominatim_export(int rank_min, int rank_max, const char *conninfo, const ch
             tuples = PQntuples(resPlaces);
             for (i = 0; i < tuples; i++)
             {
             tuples = PQntuples(resPlaces);
             for (i = 0; i < tuples; i++)
             {
-                nominatim_exportPlace(PGint32(*((uint32_t *)PQgetvalue(resPlaces, i, 0))), conn, writer, NULL, NULL);
+                nominatim_exportPlace(PGint64(*((uint64_t *)PQgetvalue(resPlaces, i, 0))), conn, writer, NULL, NULL);
                 rankTotalDone++;
                 if (rankTotalDone%1000 == 0) printf("Done %i (k)\n", rankTotalDone/1000);
             }
                 rankTotalDone++;
                 if (rankTotalDone%1000 == 0) printf("Done %i (k)\n", rankTotalDone/1000);
             }
@@ -367,7 +367,7 @@ void nominatim_exportPlace(uint64_t place_id, PGconn * conn,
     // Add, modify or delete?
     if (prevQuerySet)
     {
     // Add, modify or delete?
     if (prevQuerySet)
     {
-        if ((PQgetvalue(prevQuerySet->res, 0, 14) && strcmp(PQgetvalue(prevQuerySet->res, 0, 14), "100") == 0) || PQntuples(querySet.res))
+        if ((PQgetvalue(prevQuerySet->res, 0, 14) && strcmp(PQgetvalue(prevQuerySet->res, 0, 14), "100") == 0) || PQntuples(querySet.res) == 0)
         {
             // Delete
             if (writer_mutex) pthread_mutex_lock( writer_mutex );
         {
             // Delete
             if (writer_mutex) pthread_mutex_lock( writer_mutex );