Opened 6 years ago
Closed 6 years ago
#29743 closed Cleanup/optimization (invalid)
Queryset.extra is required to select Postgres' system columns like xmin and xmax
Reported by: | Navtez | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Normal | Keywords: | orm, queryset, models |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We use Queryset.extra to select Postgres' system columns like xmin and xmax as follows:
Model.objects.extra(select={'version': 'xmin'})
Please don't remove this as we don't find an alternative to use system columns.
Thanks!
Note:
See TracTickets
for help on using tickets.
You should be able to define
Expression
subclasses for this purpose.It should be possible to adapt the expressions to convert related references to table aliases as well (e.g.
XMin('user')
->user.xmin
) as well.