Changes between Initial Version and Version 1 of Ticket #31264, comment 2


Ignore:
Timestamp:
Feb 13, 2020, 4:10:33 AM (5 years ago)
Author:
Mariusz Felisiak

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31264, comment 2

    initial v1  
    11I am affraid that i can not provide you with the project i am working on but i replicated when i started a new project and replaced the database dictionary with my custom dictionary like this:
     2{{{
    23DATABASES = {
    34    'default': {
     
    89    }
    910}
     11}}}
    1012when i use 'django_sqlprint_middleware.SqlPrintMiddleware' plugin i am able to get the sql querry that the django admin is executing.
    1113in django 2.* the querry was :
    12 
     14{{{
    1315QUERY = 'SELECT * FROM (SELECT "_SUB".* FROM (SELECT "DJANGO_ADMIN_LOG"."ID" AS Col1, "DJANGO_ADMIN_LOG"."ACTION_TIME" AS Col2, "DJANGO_ADMIN_LOG"."USER_ID" AS Col3, "DJANGO_ADMIN_LOG"."CONTENT_TYPE_ID" AS Col4, "DJANGO_ADMIN_LOG"."OBJECT_ID" AS Col5, "DJANGO_ADMIN_LOG"."OBJECT_REPR" AS Col6, "DJANGO_ADMIN_LOG"."ACTION_FLAG" AS Col7, "DJANGO_ADMIN_LOG"."CHANGE_MESSAGE" AS Col8, "AUTH_USER"."ID" AS Col9, "AUTH_USER"."PASSWORD" AS Col10, "AUTH_USER"."LAST_LOGIN" AS Col11, "AUTH_USER"."IS_SUPERUSER" AS Col12, "AUTH_USER"."USERNAME" AS Col13, "AUTH_USER"."FIRST_NAME" AS Col14, "AUTH_USER"."LAST_NAME" AS Col15, "AUTH_USER"."EMAIL" AS Col16, "AUTH_USER"."IS_STAFF" AS Col17, "AUTH_USER"."IS_ACTIVE" AS Col18, "AUTH_USER"."DATE_JOINED" AS Col19, "DJANGO_CONTENT_TYPE"."ID" AS Col20, "DJANGO_CONTENT_TYPE"."APP_LABEL" AS Col21, "DJANGO_CONTENT_TYPE"."MODEL" AS Col22 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") WHERE "DJANGO_ADMIN_LOG"."USER_ID" = :arg0 ORDER BY "DJANGO_ADMIN_LOG"."ACTION_TIME" DESC) "_SUB" WHERE ROWNUM <= 10)' - PARAMS = (1,)
    14 
     16}}}
    1517where all columns have their aliases.
    1618In django 3 the querry is as follows :
    17 
     19{{{
    1820SELECT "DJANGO_ADMIN_LOG"."ID", "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", "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", "DJANGO_CONTENT_TYPE"."APP_LABEL", "DJANGO_CONTENT_TYPE"."MODEL"
    1921FROM "DJANGO_ADMIN_LOG"
     
    2729)
    2830WHERE "DJANGO_ADMIN_LOG"."USER_ID" = 1 ORDER BY "DJANGO_ADMIN_LOG"."ACTION_TIME" DESC FETCH FIRST 10 ROWS ONLY
    29 
     31}}}
    3032the columns does not have aliases and as a result there are 3 columns named id which causes the problem
Back to Top