#21001: Non working SQL generated for Oracle when doing .exclude('')
----------------------------------------------+--------------------
     Reporter:  greenRocker                   |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.4
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 I have a query to exclude all entries with an empty char field. This works
 as expected on sqlite and Postgres, but fails on Oracle.
 On Oracle the exclude does not exclude a single item.

 {{{
 valid_accounts = get_bank_accounts().exclude(account_number='')
 }}}

 SQL generated for Postgres looks like this (the exclude part only):

 {{{
 AND NOT ("accounts"."account_number" = ))
 }}}

 On Oracle, it looks like this:

 {{{
 AND NOT (("ACCOUNTS"."ACCOUNT_NUMBER" IS NULL
 AND "ACCOUNTS"."ACCOUNT_NUMBER"       IS NOT NULL))
 }}}

 So, in order to work on Oracle, I have to resort to:

 {{{
 valid_accounts = get_bank_accounts().filter(account_number__gte=1)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21001>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.aa5780615362fcd7341bfac424c00bcf%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to