diff --git a/api/libs/stored_values/src/jobs.rs b/api/libs/stored_values/src/jobs.rs index 8dd876583..ead00ba94 100644 --- a/api/libs/stored_values/src/jobs.rs +++ b/api/libs/stored_values/src/jobs.rs @@ -115,10 +115,10 @@ pub async fn sync_distinct_values_chunk( .context("Failed to get DB connection for finding job ID")?; stored_values_sync_jobs::table .filter(stored_values_sync_jobs::data_source_id.eq(data_source_id)) - .filter(stored_values_sync_jobs::database_name.eq(&database_name)) - .filter(stored_values_sync_jobs::schema_name.eq(&schema_name)) - .filter(stored_values_sync_jobs::table_name.eq(&table_name)) - .filter(stored_values_sync_jobs::column_name.eq(&column_name)) + .filter(stored_values_sync_jobs::database_name.eq(&database_name.to_lowercase())) + .filter(stored_values_sync_jobs::schema_name.eq(&schema_name.to_lowercase())) + .filter(stored_values_sync_jobs::table_name.eq(&table_name.to_lowercase())) + .filter(stored_values_sync_jobs::column_name.eq(&column_name.to_lowercase())) .filter(stored_values_sync_jobs::status.eq("pending")) // Only pick up pending jobs .select(stored_values_sync_jobs::id) .order(stored_values_sync_jobs::created_at.desc()) // Get the most recent pending one