I haven't physically run the same code, but what you describe
certainly sounds plausible. Generic relations are a common edge case
that gets forgotten. On top of that, sequence resets on Postgres have
changed recently (post Django 1.2-final), so it's entirely possible
that a bug has slipped in.
A ticket would be most appreciated.
> I was looking to the code to make a patch, but since the error is
> caused by "magic" m2m field in application in contrib, I hasitate to
> make postgres backend "aware" of any generic.GenericRelation fields.
> On the other hand, I'm not sure it's possible to edit just
> GenericRelation class to fix that.
You shouldn't need to make the PostgreSQL backend aware of the
existence of GenericRelation. Fields contain a 'serialize' option that
is used to determine if a relation should be serialized as part of a
fixture. Not deserializing GenericRelations is the primary reason for
the existence of this setting. I'd need to check to be certain, but I
think the reason that GenericRelations can't be serialized will turn
out to be exactly the same as the reason they have their sequences
reset.
If it turns out that this isn't the case, I have no problem adding
another flag that *does* identify the right use case (i.e., not
"is_generic_relation", but "requires_sequence_reset", or something
like it).
Of related interest would be to check if this issue existed previously
(i.e., before the recent PostgreSQL sequence changes); if the issue
didn't exist in Django 1.2 final, then checking the diff between the
old and new implementations may also shed some light on potential
solutions.
Yours,
Russ Magee %-)
ticket created as #13941
I'll try to find out more and let you know in this thread.
Thanks,
A.
------------------------------------------------------
Ales Zoulek
+420 604 332 515
Jabber: ales....@gmail.com
------------------------------------------------------
> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>
>
1] It's changed since changeset 13328
(http://code.djangoproject.com/changeset/13328)
2] Previous versions DID reset the sequence thru GenericRelation
fields, but it did it on the right table so it worked. It just called
useless code. In our example, the second query would set blog_tag
sequence to max(blog_tag.id)
3] I've created a patch and a test, that keeps the older behaviour.
Please see the ticket.
4] We can consider find a way how to skip the second sql query altogether.
A.
------------------------------------------------------
Ales Zoulek
+420 604 332 515
Jabber: ales....@gmail.com
------------------------------------------------------
I think so. And now I remember actually we discussed about this on
#django-dev a couple of weeks ago but I forgot to open a ticket:
http://botland.oebfare.com/logger/django-dev/2010/6/23/1/#02:04-2311026
Regards,
--
Ramiro Morales | http://rmorales.net