Skip to content

Commit

Permalink
fix CTE syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Jun 6, 2024
1 parent 77e3080 commit 6b63d22
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nexus/db-queries/src/db/queries/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ impl QueryFragment<Pg> 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)?;
Expand All @@ -357,8 +358,9 @@ impl QueryFragment<Pg> 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, ");
Expand Down

0 comments on commit 6b63d22

Please sign in to comment.