diff --git a/pkg/sql/schemachanger/sctest/framework.go b/pkg/sql/schemachanger/sctest/framework.go index ccac27c8a963..41873fea51a5 100644 --- a/pkg/sql/schemachanger/sctest/framework.go +++ b/pkg/sql/schemachanger/sctest/framework.go @@ -949,7 +949,7 @@ func waitForSchemaChangesToFinish(t *testing.T, tdb *sqlutils.SQLRunner) { func hasLatestSchemaChangeSucceeded(t *testing.T, tdb *sqlutils.SQLRunner) bool { result := tdb.QueryStr(t, fmt.Sprintf( - `SELECT status FROM [SHOW JOBS] WHERE job_type IN ('%s') ORDER BY finished DESC LIMIT 1`, + `SELECT status FROM [SHOW JOBS] WHERE job_type IN ('%s') ORDER BY finished DESC, job_id DESC LIMIT 1`, jobspb.TypeNewSchemaChange, )) return result[0][0] == "succeeded"