Opened 14 months ago
Closed 14 months ago
#34969 closed Cleanup/optimization (duplicate)
Documentation is misleading about SQL equivalent
Reported by: | Piotr Kotarba | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Below misleading has been checked for 3.2, but I assume it might also apply for all remaining version up to 4.2(not checked).
Documentation says:
Code highlighting:
**Example:** Blog.objects.get(name__iexact="beatles blog") Blog.objects.get(name__iexact=None) **SQL equivalents:** SELECT ... WHERE name ILIKE 'beatles blog'; SELECT ... WHERE name IS NULL;
Based on a code of Django itself I have found out that not every backend uses ILIKE.
For example postgresql or Oracle uses UPPER:
Code highlighting:
class DatabaseWrapper(BaseDatabaseWrapper): vendor = 'oracle' display_name = 'Oracle' _standard_operators = { 'exact': '= %s', 'iexact': '= UPPER(%s)', ... }
You can check that under:
django.db.backends.oracle.base.DatabaseWrapper
Change History (1)
comment:1 by , 14 months ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
Note:
See TracTickets
for help on using tickets.
Duplicate of #20775.