                        providers/dbresult->provider)
           t (h/get-provider-collection-tablename provider)]
       (for [concept-id concept-ids
-            :let [result (j/query (config/db) [(format "select distinct entry_title from metadata_db.%s where concept_id = ?" t)
-                                               concept-id])]]
-        (:entry_title (first result))))))
+            :let [result (j/query (config/db) [(format "select distinct concept_id, entry_title from metadata_db.%s where concept_id = ?" t)
+                                               concept-id])]
+            :when (not (nil? concept-id))]
+        (first result)))))
 
 (defn up
   "Migrates the database up to version 57."

                       providers/dbresult->provider)
          t (h/get-provider-collection-tablename provider)]
      (for [entry-title entry-titles
            :let [result (j/query (config/db) [(format "select distinct concept_id from metadata_db.%s where entry_title = ?" t)
                                               entry-title])]]
        (:concept_id (first result))))))

(defn- get-entry-titles
  "For a given provider and concept-ids in collection-identifier, returns list of collection entry-titles"

                       (util/gzip-blob->string)
                       (edn/read-string))
          {{:keys [collection-identifier collection-applicable granule-applicable provider-id]} :catalog-item-identity} metadata
          collections-by-entry-titles (when (or collection-applicable granule-applicable)
                                        (get-concept-ids provider-id collection-identifier))
          collections-by-concept-ids (when (or collection-applicable granule-applicable)
                                       (get-entry-titles provider-id collection-identifier))
          collections (distinct (remove nil? (concat collections-by-entry-titles collections-by-concept-ids)))
          metadata (if deleted
                     metadata
                     (if (seq collections)
                       (-> metadata
                           (assoc-in [:catalog-item-identity :collection-identifier :concept-ids] (map :concept_id collections))
                           (assoc-in [:catalog-item-identity :collection-identifier :entry-titles] (map :entry_title collections)))
                       metadata))
          metadata (-> metadata
                       pr-str
