Skip to content

Pony: BitField support #1

Open
Open
@alex

Description

@alex

PostgreSQL has awesome support for bit fields, this should support 'em!

Activity

zacharyvoase

zacharyvoase commented on Aug 21, 2012

@zacharyvoase
Owner

Happening.

Also happening:

>>> Model.objects.filter(bitfield__xor='110101')
>>> Model.objects.update(bitfield=B('bitfield') ^ '110101')

Et cetera. I like ExpressionNode for this kind of stuff.

alex

alex commented on Aug 21, 2012

@alex
Author

Awesome, didn't see it noted in the "future" section, so I figured I'd bring it up.

zacharyvoase

zacharyvoase commented on Aug 21, 2012

@zacharyvoase
Owner

Yup. Seems easy enough to implement; I may be able to get it done this arvo.

zacharyvoase

zacharyvoase commented on Aug 21, 2012

@zacharyvoase
Owner

OK. Not that easy to implement.

There's a basic implementation of the BIT and VARBIT types here. There’s also a B()-expression syntax thing for manipulating bit strings atomically; see these test cases for a short example.

The biggest problem, currently, is the implementation of custom query predicates based on the bitwise operators. Stuff like __xor, which I think would be really useful. Also, I’d love a query aggregate like popcount(), but apparently Postgres doesn’t even have that built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Pony: BitField support · Issue #1 · zacharyvoase/django-postgres