Author: rjollos Date: Mon Mar 3 04:28:51 2014 New Revision: 1573440 URL: http://svn.apache.org/r1573440 Log: 0.8dev: Use column name for determining the MAX value when updating the sequence. Refs #708.
Patch by Olemis Lang. This change will be reverted when trac:#11512 is merged. Modified: bloodhound/trunk/trac/trac/db/postgres_backend.py Modified: bloodhound/trunk/trac/trac/db/postgres_backend.py URL: http://svn.apache.org/viewvc/bloodhound/trunk/trac/trac/db/postgres_backend.py?rev=1573440&r1=1573439&r2=1573440&view=diff ============================================================================== --- bloodhound/trunk/trac/trac/db/postgres_backend.py (original) +++ bloodhound/trunk/trac/trac/db/postgres_backend.py Mon Mar 3 04:28:51 2014 @@ -255,8 +255,8 @@ class PostgreSQLConnection(ConnectionWra def update_sequence(self, cursor, table, column='id'): cursor.execute(""" - SELECT setval('"%s_%s_seq"', (SELECT MAX(id) FROM %s)) - """ % (table, column, table)) + SELECT setval('"%s_%s_seq"', (SELECT MAX(%s) FROM %s)) + """ % (table, column, column, table)) def cursor(self): return IterableCursor(self.cnx.cursor(), self.log)