#3201: PostgreSQL index introspection fails on tables (get relations)
----------------------------------+-----------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Database wrapper
Version: SVN | Resolution:
Keywords: postgresql | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 1 | Needs_better_patch: 1
----------------------------------+-----------------------------------------
Changes (by Michael Radziej <[EMAIL PROTECTED]>):
* stage: Unreviewed => Accepted
Comment:
I have verified that the bug exists with postgresql_psycopg2, but the
patch is not correct.
When I try your schema with psycopg and psycopg2, I get these differences
in the created models:
{{{
--- /tmp/mod1.py 2007-04-24 13:04:45.000000000 +0200
+++ /tmp/mod2.py 2007-04-24 13:04:06.000000000 +0200
@@ -12,18 +12,18 @@
class Admin(models.Model):
admin_id = models.IntegerField(primary_key=True)
firstname = models.CharField(maxlength=100)
lastname = models.CharField(maxlength=150)
- username = models.ForeignKey(Staff, db_column='username')
+ username = models.CharField(maxlength=50)
email = models.CharField(unique=True, maxlength=150)
department = models.CharField(maxlength=150)
- last_login = models.ForeignKey(Staff, db_column='last_login')
+ last_login = models.DateTimeField()
admin_level = models.SmallIntegerField()
- staff = models.ForeignKey(Staff)
+ staff_id = models.SmallIntegerField()
mail_comments = models.BooleanField()
mail_trackback = models.BooleanField()
publish_right = models.BooleanField()
- last_updated = models.ForeignKey(Staff, db_column='last_updated')
+ last_updated = models.DateTimeField()
class Meta:
db_table = 'admin'
class Users(models.Model):
@@ -43,9 +43,9 @@
category_id = models.IntegerField(primary_key=True)
name = models.CharField(maxlength=255)
icon = models.CharField(maxlength=255)
description = models.TextField()
- author = models.ForeignKey(Staff)
+ author_id = models.SmallIntegerField()
category_left = models.SmallIntegerField()
catefory_right = models.SmallIntegerField()
parent_id = models.SmallIntegerField()
class Meta:
}}}
The patch fails to detect foreign key constraints. I use postgresql 8.1.8
(ubuntu-dapper) and psycopg 2.0 (self-compiled)
--
Ticket URL: <http://code.djangoproject.com/ticket/3201#comment:8>
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
-~----------~----~----~----~------~----~------~--~---