Skip to content

hkeys() does not return all keys  #131

Open
@aschriner

Description

@aschriner

@select_query
def hkeys(self, query, attr):
"""
Enumerates the keys in the specified hstore.
"""
query.add_extra({'_': 'akeys("%s")' % attr}, None, None, None, None, None)
result = query.get_compiler(self.db).execute_sql(SINGLE)
return (result[0] if result else [])

I've verified in my own code that this is not returning all keys.

http://stackoverflow.com/questions/12015942/most-efficient-way-to-retrieve-a-unique-list-of-keys-from-all-rows-of-an-hstore

The hkeys() method probably needs a DISTINCT clause. Will follow up with a PR.

Update:

  • I'm trying to use hkeys on a queryset, which isn't mentioned in the docs. So I think I'm looking at adding functionality here rather than fixing a bug.
  • I'm trying to get tests running locally and I'm seeing some errors with dependencies. I've pip installed requirements.txt but still seeing stuff like django.core.exceptions.ImproperlyConfigured: GEOS is required and has not been detected. Are you sure it is installed? See also https://docs.djangoproject.com/en/1.8/ref/contrib/gis/install/geolibs/ Can you provide any info on how to get tests running locally, what needs to be installed, etc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions