Skip to content

Commit

Permalink
Prevent sequence reset with certain DB backends (Bug #13876).
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 9, 2015
1 parent e881e3e commit d665982
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/History/lib/Horde/History/Sql.php
Expand Up @@ -355,7 +355,9 @@ protected function _nextModSeq()
{
try {
$result = $this->_db->insert('INSERT INTO horde_histories_modseq (history_modseqempty) VALUES(0)');
$this->_db->delete('DELETE FROM horde_histories_modseq WHERE history_modseq <> ?', array($result));
// Don't completely empty the table to prevent sequence from being reset
// when using certain RDBMS, like postgres (see Bug #13876).
$this->_db->delete('DELETE FROM horde_histories_modseq WHERE history_modseq < (? - 25)', array($result));
} catch (Horde_Db_Exception $e) {
throw new Horde_History_Exception($e);
}
Expand Down

0 comments on commit d665982

Please sign in to comment.