#4432: get_sql_sequence_reset doesn't work on tables that have no records.
--------------------------------------------------------------------+-------
   Reporter:  mrmachine                                             |           
     Owner:  adrian          
     Status:  new                                                   |           
 Component:  Database wrapper
    Version:  SVN                                                   |           
Resolution:                  
   Keywords:  get_sql_sequence_reset max id empty table no records  |           
     Stage:  Unreviewed      
  Has_patch:  1                                                     |           
Needs_docs:  0               
Needs_tests:  0                                                     |   
Needs_better_patch:  0               
--------------------------------------------------------------------+-------
Changes (by [EMAIL PROTECTED]):

  * needs_better_patch:  => 0
  * has_patch:  0 => 1
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 added a patch to fix this bug in postgresql and postgresql_psycopg2 by
 setting the new sequence to coalesce(max(pk), 1) and passing setval's 3rd
 argument is_called to true if there are records or false if not.
 
 this ensures that the primary key of the next record inserted will be 1 if
 the table is empty, or max(pk) + 1 if there are records.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4432#comment:1>
Django Code <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
-~----------~----~----~----~------~----~------~--~---

Reply via email to