Code

Opened 4 years ago

Closed 4 years ago

#12739 closed (invalid)

Inconsistent sorting behavior in mult-table inheritance query for different database backends

Reported by: gsong Owned by: nobody
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Given the following models:

from django.db import models

class A(models.Model):
    name = models.CharField(max_length=50)

class B(A):
   pass

class C(A):
   pass

The following query returns different queryset order for sqlite3 vs. postgresql_psycopg2:

A.objects.order_by('b', 'name')

SQLite will sort B objects, followed by C objects. PostgreSQL will sort C objects, followed by B objects.

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

This looks to be a DB level inconsistency, not something Django can control. Unless there's something I'm missing closing as wontfix.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.