Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#29736 closed Bug (duplicate)

Admin interface causes ORA-00918: column ambiguously defined

Reported by: Rafael Zinezi Araújo Owned by: nobody
Component: contrib.admin Version: 2.1
Severity: Normal Keywords: oracle admin exception
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

As per ticket #29630 same bug.

Attempting to log in to the admin interface causes a SQL exception to be raised when using an Oracle database. The exception throw by Oracle is ... ORA-00918: column ambiguously defined.
Database: Oracle 12.1
cx_Oracle version: 6.4.1
Python 3.5.2
Steps to reproduce...
1) Start a project
2) Configure the use of Oracle as a database
3) Execute makemigrations
4) Execute migrate
5) Execute createsuperuser
6) Execute runserver
7) Open localhost:8000/admin in a browser
8) Enter admin username/password and click to log in

Was able to extract the offending query from traceback and found that when base.html runs it, in this case, it has multiple columns named ID (from 3 tables: Django_Admin_Log, Auth_User and Django_Content_Type).

Attachments (2)

id ora bug.jpg (140.6 KB ) - added by Rafael Zinezi Araújo 6 years ago.
screenshot of the query highlighting my "theory"
id ora bug.2.jpg (140.6 KB ) - added by Rafael Zinezi Araújo 6 years ago.
screenshot of the query highlighting my "theory"

Download all attachments as: .zip

Change History (5)

comment:1 by Rafael Zinezi Araújo, 6 years ago

Last edited 6 years ago by Rafael Zinezi Araújo (previous) (diff)

by Rafael Zinezi Araújo, 6 years ago

Attachment: id ora bug.jpg added

screenshot of the query highlighting my "theory"

comment:2 by Rafael Zinezi Araújo, 6 years ago

by parsing and running the query in a script the same error occurs.
by aliasing the columns it goes away.

SELECT 		DJANGO_ADMIN_LOG.ID logid, 
		DJANGO_ADMIN_LOG.ACTION_TIME, 
 		DJANGO_ADMIN_LOG.USER_ID, 
 		DJANGO_ADMIN_LOG.CONTENT_TYPE_ID,
 		DJANGO_ADMIN_LOG.OBJECT_ID, 
 		DJANGO_ADMIN_LOG.OBJECT_REPR, 
 		DJANGO_ADMIN_LOG.ACTION_FLAG, 
 		DJANGO_ADMIN_LOG.CHANGE_MESSAGE, 
 		AUTH_USER.ID authid, 
 		AUTH_USER.PASSWORD, 
 		AUTH_USER.LAST_LOGIN, 
 		AUTH_USER.IS_SUPERUSER, 
 		AUTH_USER.USERNAME, 
 		AUTH_USER.FIRST_NAME, 
 		AUTH_USER.LAST_NAME, 
 		AUTH_USER.EMAIL, 
 		AUTH_USER.IS_STAFF, 
 		AUTH_USER.IS_ACTIVE, 
 		AUTH_USER.DATE_JOINED, 
 		DJANGO_CONTENT_TYPE.ID contid, 
 		DJANGO_CONTENT_TYPE.APP_LABEL, 
 		DJANGO_CONTENT_TYPE.MODEL 
FROM DJANGO_ADMIN_LOG 
 	INNER JOIN AUTH_USER 
		ON (DJANGO_ADMIN_LOG.USER_ID = AUTH_USER.ID) 
	LEFT OUTER JOIN DJANGO_CONTENT_TYPE 
		ON (DJANGO_ADMIN_LOG.CONTENT_TYPE_ID = DJANGO_CONTENT_TYPE.ID)
ORDER BY DJANGO_ADMIN_LOG.ACTION_TIME DESC 
FETCH FIRST 10 ROWS ONLY
Last edited 6 years ago by Rafael Zinezi Araújo (previous) (diff)

by Rafael Zinezi Araújo, 6 years ago

Attachment: id ora bug.2.jpg added

screenshot of the query highlighting my "theory"

comment:3 by Rafael Zinezi Araújo, 6 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #29630.

Last edited 6 years ago by Tim Graham (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top