Brandon and I discussed this in IRC briefly and thought that it might be useful to add a general function that walks the database schema looking for tables with sequences, checks the foo.bar_id_seq.last_value versus the foo.bar.id value, and calls setval() if max(id) is ahead of last_value.
This function could then be invoked at the start of each upgrade script to circumvent DBA misbehaviour. You would certainly want to do it when the database is quiesced, in any case.
Brandon said he would try to work something up. Go Brandon!
Brandon and I discussed this in IRC briefly and thought that it might be useful to add a general function that walks the database schema looking for tables with sequences, checks the foo.bar_ id_seq. last_value versus the foo.bar.id value, and calls setval() if max(id) is ahead of last_value.
This function could then be invoked at the start of each upgrade script to circumvent DBA misbehaviour. You would certainly want to do it when the database is quiesced, in any case.
Brandon said he would try to work something up. Go Brandon!