From 01f9c73f0140a60b83e77ad778bdbe4695c235cf Mon Sep 17 00:00:00 2001 From: Brad Erickson Date: Sat, 18 Apr 2020 00:32:06 -0700 Subject: [PATCH] fixup! feat: Update SERIAL sequence after INSERT queries --- cmd/axon/schema.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/axon/schema.go b/cmd/axon/schema.go index 4b680862..b06288b2 100644 --- a/cmd/axon/schema.go +++ b/cmd/axon/schema.go @@ -109,6 +109,10 @@ func isSerialColumn(table, column string) bool { } func updateSerialColumnSequence(conn *sqlx.DB, table string, columns []*warppipe.ChangesetColumn) error { + // Why no transaction? From the manual: Important: Because sequences are + // non-transactional, changes made by setval are not undone if the transaction + // rolls back. + // ref: https://www.postgresql.org/docs/9.6/functions-sequence.html for _, column := range columns { if !isSerialColumn(table, column.Column) { continue