#13179: last_insert_id method cannot find sequence
---------------------------+------------------------------------------------
Reporter: grangerp | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
On line 55 of file django/db/postgresql/operations.py
method
{{{
def last_insert_id(self, cursor, table_name, pk_name):
cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name,
pk_name))
return cursor.fetchone()[0]
}}}
should be like
{{{
def last_insert_id(self, cursor, table_name, pk_name):
cursor.execute("SELECT CURRVAL(pg_get_serial_sequence('%s', '%s'))" %
(table_name, pk_name))
return cursor.fetchone()[0]
}}}
because the sequence can have different name that
{table_name}_{pk_name}_seq
--
Ticket URL: <http://code.djangoproject.com/ticket/13179>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.