#24367: ORA-00918 (column ambiguously defined) when using a combination of
slicing,
distinct, and order_by
-------------------------------------+-------------------------------------
Reporter: skoot | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.7
(models, ORM) |
Severity: Normal | Resolution:
Keywords: ORA-00918 oracle | Triage Stage:
queryset | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Kishor Pawar):
Replying to [comment:5 Tim Graham]:
> Could you give a QuerySet that reproduces the problem rather than
something that requires Django REST Framework?
Sorry for delayed reply. I did not get notification for your reply.
Query =
{{{
ResourceMgmt.objects.filter(is_active='Y')\
.filter(schedule_next_run_time__lt=future)\ # future is calculated
date
.filter(schedule_end_time__gt=now + datetime.timedelta(minutes=1))\
.extra(where=["schedule_next_run_time > sysdate -
(schedule_frequency/1440)",
"owner_id IN ( \
select id from cpe_user \
where is_active='Y' \
connect by prior id = parent_id start with id = % s)"],
154)
}}}
the output looks like
{{{
{"count":4,"next":null,"previous":null,"results":[{"id":396511,"owner":385436,"owner_login":"[email protected]","resource_owner":"[email protected]","resource":396387,"resource_name":"20nov","profile":157,"profile_name":"some
string
here","run_remediate":"Y","schedule_start_time":"2017-11-20T06:05:00.578032Z","schedule_frequency":1,"schedule_create_time":"2017-11-20T06:02:35Z","schedule_end_time":"2017-11-20T06:05:00.578032Z","schedule_next_run_time":"2017-11-20T06:05:00.578032Z","is_active":"Y","run_cost_scan":"28.00","run_cost_remediate":"140.00","last_run":null,"created_by":"[email protected]","create_date":"2017-11-20T06:04:00Z","updated_by":"RAXAK3","update_date":"2017-11-20T06:05:00Z","overall_status":null,"overall_info":null,"resource_info":{"username":"raxak","os_version":"v6.3.9600","os_architecture":"6.3.9600","os_name":"some
string
here","ip_addr":"103.157.4.217"}},{"id":380200,"owner":379468,"owner_login":"[email protected]","resource_owner":"[email protected]","resource":379903,"resource_name
":"WIN-EOVV3Q2I5KK","profile":157,"profile_name":"some string
here","run_remediate":"N","schedule_start_time":"2017-11-17T09:49:03.235260Z","schedule_frequency":1,"schedule_create_time":"2017-11-17T09:46:38Z","schedule_end_time":"2017-11-17T09:49:03.235260Z","schedule_next_run_time":"2017-11-17T09:49:03.235260Z","is_active":"Y","run_cost_scan":"28.00","run_cost_remediate":"140.00","last_run":null,"created_by":"[email protected]","create_date":"2017-11-17T09:48:03Z","updated_by":"RAXAK3","update_date":"2017-11-17T09:49:00Z","overall_status":null,"overall_info":null,"resource_info":{"username":"raxak","os_version":"v6.3.9600","os_architecture":"6.3.9600","os_name":"Microsoft
Windows Server 2012
R2","ip_addr":"13.126.155.240"}},{"id":367211,"owner":354149,"owner_login":"[email protected]","resource_owner":"[email protected]","resource":359474,"resource_name":"2012_1","profile":359771,"profile_name":"prof1","run_remediate":"N","schedule_start_time":"2017-11-16T08:47:24.278393Z","schedule_frequency":1,"schedule_create_time":"2017-11-16T08:45:00Z","schedule_end_time":"2017-11-16T08:47:24.278393Z","schedule_next_run_time":"2017-11-16T08:47:24.278393Z","is_active":"Y","run_cost_scan":"0.50","run_cost_remediate":"2.50","last_run":null,"created_by":"[email protected]","create_date":"2017-11-16T08:46:24Z","updated_by":"RAXAK3","update_date":"2017-11-16T08:47:00Z","overall_status":null,"overall_info":null,"resource_info":{"username":"raxak","os_version":"v6.3.9600","os_architecture":"6.3.9600","os_name":"Microsoft
Windows Server 2012
R2","ip_addr":"13.127.3.77"}},{"id":366341,"owner":354149,"owner_login":"[email protected]","resource_owner":"[email protected]","resource":359474,"resource_name":"2012_1","profile":157,"profile_name":"some
string
here","run_remediate":"Y","schedule_start_time":"2017-11-16T08:29:24.543755Z","schedule_frequency":1,"schedule_create_time":"2017-11-16T08:27:00Z","schedule_end_time":"2017-11-16T08:29:24.543755Z","schedule_next_run_time":"2017-11-16T08:29:24.543755Z","is_active":"Y","run_cost_scan":"28.00","run_cost_remediate":"140.00","last_run":null,"created_by":"[email protected]","create_date":"2017-11-16T08:28:24Z","updated_by":"RAXAK3","update_date":"2017-11-16T08:29:00Z","overall_status":null,"overall_info":null,"resource_info":{"username":"raxak","os_version":"v6.3.9600","os_architecture":"6.3.9600","os_name":"some
string here","ip_addr":"13.127.3.77"}}]}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24367#comment:6>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.65f0df1731a78bf9d1c4de0385e3e99d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.