diff --git a/nexus/db-queries/src/db/queries/instance.rs b/nexus/db-queries/src/db/queries/instance.rs index a5e5d86794..6cde96fce8 100644 --- a/nexus/db-queries/src/db/queries/instance.rs +++ b/nexus/db-queries/src/db/queries/instance.rs @@ -342,9 +342,10 @@ impl QueryFragment for InstanceAndVmmUpdate { out.push_identifier(instance_dsl::id::NAME)?; out.push_sql(" = instance_updated."); out.push_identifier(instance_dsl::id::NAME)?; - out.push_sql(") "); + out.push_sql(")"); if self.migration.is_some() { + out.push_sql(", "); out.push_sql("migration_result AS ("); out.push_sql("SELECT migration_found."); out.push_identifier(migration_dsl::id::NAME)?; @@ -357,8 +358,9 @@ impl QueryFragment for InstanceAndVmmUpdate { out.push_identifier(migration_dsl::id::NAME)?; out.push_sql(" = migration_updated."); out.push_identifier(migration_dsl::id::NAME)?; - out.push_sql(") "); + out.push_sql(")"); } + out.push_sql(" "); out.push_sql("SELECT vmm_result.found, vmm_result.updated, "); out.push_sql("instance_result.found, instance_result.updated, ");