Opened 4 years ago

Last modified 3 months ago

#27694 new Cleanup/optimization

Improve documentation of supported lookups on HStore & JSON fields

Reported by: Stephen Burrows Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The documentation of supported lookups on HStore & JSON fields is lacking. For example, HStoreField supports iexact lookups, but the documentation has a scary warning implying that this is not the case:

Since any string could be a key in a hstore value, any lookup other than those listed below will be interpreted as a key lookup.

iexact is not listed below – but neither is contains, which is used directly above the scary warning as an example of how "You can chain other lookups after key lookups". (Actually, contains is listed below, but it's a different contains that applies only to the field level and not to a specific key.)

I suspect that the intended meaning is that all lookups are supported after a key lookup, and that the first lookup on the hstore field must be a key or one of the special lookups listed below.

JSONField does not mention being able to chain lookups after key lookups at all - but I can see people using gt and in in blog posts like this. BUT iexact lookups don't currently work on JSONField.

Change History (3)

comment:1 Changed 4 years ago by Tim Graham

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

comment:2 Changed 5 months ago by felixxm

JSONField-part of this ticket is fixed as a part of PR.

comment:3 Changed 3 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In 6789ded0:

Fixed #12990, Refs #27694 -- Added JSONField model field.

Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.

Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@…>

Note: See TracTickets for help on using tickets.
Back to Top