Ticket #13295: postgresql_name_seq.2.diff
File postgresql_name_seq.2.diff, 2.5 KB (added by , 15 years ago) |
---|
-
django/db/models/sql/compiler.
old new 785 785 return 786 786 if self.connection.features.can_return_id_from_insert: 787 787 return self.connection.ops.fetch_returned_insert_id(cursor) 788 return self.connection.ops.last_insert_id(cursor, 788 if 'db_seq' in self.query.model._meta.__dict__: 789 return self.connection.ops.last_insert_id(cursor, 790 self.query.model._meta.db_seq, '') 791 else: 792 return self.connection.ops.last_insert_id(cursor, 789 793 self.query.model._meta.db_table, self.query.model._meta.pk.column) 790 794 791 795 -
django/db/models/options.
old new 18 18 # Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces". 19 19 get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip() 20 20 21 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering', 21 DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering', 'db_seq', 22 22 'unique_together', 'permissions', 'get_latest_by', 23 23 'order_with_respect_to', 'app_label', 'db_tablespace', 24 24 'abstract', 'managed', 'proxy', 'auto_created') … … 30 30 self.module_name, self.verbose_name = None, None 31 31 self.verbose_name_plural = None 32 32 self.db_table = '' 33 self.db_seq = '' 33 34 self.ordering = [] 34 35 self.unique_together = [] 35 36 self.permissions = [] -
django/db/backends/postgresql/operations.
old new 54 54 return '%s' 55 55 56 56 def last_insert_id(self, cursor, table_name, pk_name): 57 cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name)) 57 if pk_name: 58 cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name)) 59 else: 60 cursor.execute("SELECT CURRVAL('\"%s_seq\"')" % table_name) 58 61 return cursor.fetchone()[0] 59 62 60 63 def no_limit_value(self):