﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13179	last_insert_id method cannot find sequence	grangerp	nobody	"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"	Bug	closed	Database layer (models, ORM)	1.1	Normal	duplicate			Design decision needed	1	0	1	1	0	0
