Skip to content

Commit

Permalink
Merge #31558
Browse files Browse the repository at this point in the history
31558: importccl: allow sequence retries in pgdump test r=mjibson a=mjibson

Fixes #30495

Release note: None

Co-authored-by: Matt Jibson <[email protected]>
  • Loading branch information
craig[bot] and maddyblue committed Oct 18, 2018
2 parents 6e7ed1b + 6a47434 commit 414df93
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/ccl/importccl/import_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2361,12 +2361,18 @@ func TestImportPgDump(t *testing.T) {
"a_seq", `CREATE SEQUENCE a_seq MINVALUE 1 MAXVALUE 9223372036854775807 INCREMENT 1 START 1`,
}})
sqlDB.CheckQueryResults(t, `select last_value from a_seq`, [][]string{{"7"}})
sqlDB.Exec(t, `INSERT INTO seqtable (b) VALUES (70)`)
sqlDB.CheckQueryResults(t,
`SELECT * FROM seqtable ORDER BY a`,
sqlDB.QueryStr(t, `select a+1, a*10 from generate_series(0, 7) a`),
sqlDB.QueryStr(t, `select a+1, a*10 from generate_series(0, 6) a`),
)
sqlDB.CheckQueryResults(t, `select last_value from a_seq`, [][]string{{"7"}})
// This can sometimes retry, so the next value might not be 8.
sqlDB.Exec(t, `INSERT INTO seqtable (b) VALUES (70)`)
sqlDB.CheckQueryResults(t, `select last_value >= 8 from a_seq`, [][]string{{"true"}})
sqlDB.CheckQueryResults(t,
`SELECT b FROM seqtable WHERE a = (SELECT last_value FROM a_seq)`,
[][]string{{"70"}},
)
sqlDB.CheckQueryResults(t, `select last_value from a_seq`, [][]string{{"8"}})
}
})
}
Expand Down

0 comments on commit 414df93

Please sign in to comment.