Ticket #10233: exclude_sql.txt

File exclude_sql.txt, 2.8 KB (added by andrewl, 16 years ago)

Django v1.0.x SQL and error traceback vs Django Trunk SQL

Line 
1Django TRUNK (OK):
2 > MentorUser.objects.exclude(mymentornode__metadata__name='nationality').query.as_sql()
3 > ('SELECT "auth_user"."id", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."password", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."is_superuser", "auth_user"."last_login", "auth_user"."date_joined", "design_mentoruser"."user_ptr_id", "design_mentoruser"."access_level", "design_mentoruser"."mymentornode_id" FROM "design_mentoruser" INNER JOIN "auth_user" ON ("design_mentoruser"."user_ptr_id" = "auth_user"."id") WHERE NOT ("design_mentoruser"."mymentornode_id" IN (SELECT U2."owner_id" FROM "design_metadata" U2 WHERE U2."name" = %s ) AND "design_mentoruser"."mymentornode_id" IS NOT NULL)', ('nationality',))
4
5
6Django 1.0.2 (FAIL):
7 > MentorUser.objects.exclude(mymentornode__metadata__name='nationality').query.as_sql()
8 > ('SELECT "auth_user"."id", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."password", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."is_superuser", "auth_user"."last_login", "auth_user"."date_joined", "design_mentoruser"."user_ptr_id", "design_mentoruser"."access_level", "design_mentoruser"."mymentornode_id" FROM "design_mentoruser" INNER JOIN "auth_user" ON ("design_mentoruser"."user_ptr_id" = "auth_user"."id") WHERE NOT ("design_mentoruser"."mymentornode_id" IN (SELECT U2."owner_id" FROM "design_mentoruser" U0 INNER JOIN "design_metadata" U2 ON (U1."id" =U2."owner_id") WHERE U2."name" = %s ))', ('nationality',))
9
10
11 >>> MentorUser.objects.exclude(mymentornode__metadata__name='nationality')
12 Traceback (most recent call last):
13 File "<console>", line 1, in <module>
14 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\models\query.py", li
15 ne 147, in __repr__
16 data = list(self[:REPR_OUTPUT_SIZE + 1])
17 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\models\query.py", li
18 ne 162, in __len__
19 self._result_cache.extend(list(self._iter))
20 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\models\query.py", li
21 ne 275, in iterator
22 for row in self.query.results_iter():
23 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\models\sql\query.py"
24 , line 206, in results_iter
25 for rows in self.execute_sql(MULTI):
26 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\models\sql\query.py"
27 , line 1734, in execute_sql
28 cursor.execute(sql, params)
29 File "C:\eclipse\workspaces\mentor\django-1.0.2\django\db\backends\util.py", l
30 ine 19, in execute
31 return self.cursor.execute(sql, params)
32 ProgrammingError: missing FROM-clause entry in subquery for table "u1"
33 LINE 1: ...entoruser" U0 INNER JOIN "design_metadata" U2 ON (U1."id" = ...
34
35
Back to Top