Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30986 closed Bug (fixed)

Using conditional RawSQL's in QuerySet.filter() crashes on Oracle.

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Database layer (models, ORM) Version: 3.0
Severity: Release blocker Keywords: oracle rawsql
Cc: Simon Charette, Carlton Gibson Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using conditional RawSQL's in QuerySet.filter() crashes on Oracle, e.g.

Company.objects.filter(
    RawSQL('num_employees > %s', (3,), output_field=models.BooleanField()),
)

raises django.db.utils.DatabaseError: ORA-00933: SQL command not properly ended.

This as a release blocker because using conditional expressions in QuerySet.filter() is a new feature added in #25367.

Reported in PR12067.

Change History (3)

comment:1 by Mariusz Felisiak, 5 years ago

Cc: Simon Charette Carlton Gibson added
Has patch: set
Keywords: rawsql added

comment:2 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 8685e764:

Fixed #30986 -- Fixed queryset crash when filtering against boolean RawSQL expressions on Oracle.

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

In b6be069:

[3.0.x] Fixed #30986 -- Fixed queryset crash when filtering against boolean RawSQL expressions on Oracle.

Backport of 8685e764efd2957085762d9249e07794d9a58dcb from master

Note: See TracTickets for help on using tickets.
Back to Top