Opened 6 years ago
Closed 6 years ago
#30336 closed New feature (duplicate)
F() expression wrong result on postgres JSONField
Reported by: | blue-note | Owned by: | armansabyr |
---|---|---|---|
Component: | contrib.postgres | Version: | dev |
Severity: | Normal | Keywords: | jsonfield, postgres, F |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
On the model
class Product(Model): properties = JSONField()
when querying with Product.objects.values('properties__color')
, the resulting query is SELECT ("product"."properties" -> 'color') FROM "product"
However, when using the equivalent F() expression product = Product.objects.values(color=F('properties__color'))}} the resulting query is {{{SELECT "product"."properties" AS "color" FROM "product"
, which ignores part of the field name
Change History (2)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Component: | Database layer (models, ORM) → contrib.postgres |
---|---|
Keywords: | F added |
Resolution: | → duplicate |
Status: | assigned → closed |
Type: | Bug → New feature |
Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
Duplicate of #29769.