Re: bytea bitwise logical operations implementation (xor / and / or / not)

From: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Christian Rossow <christian(dot)rossow(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: bytea bitwise logical operations implementation (xor / and / or / not)
Date: 2018-01-12 10:15:20
Message-ID: CAC8Q8tKn0M5D5pRiJA8fguzfXnvEoiAm0e4qzjqHbTqAOTK8RA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

working with binary is certainly lacked in Postgres.

I would be happy if these can be pulled in to Postgres, as there's not
always a possibility to install a C based extension, and bit tricks are
needed for efficient SQL-level implementations of custom datatypes.

Another bitwise thing, when I was implementing a custom interval type, I
lacked a way to set bits from i to j in bit vector. It's probably doable
with clever and-or-xor tricks, but that would imply a lot of allocations of
temporary bit vectors.

For reference, it was subset of OpenStreetMap opening_hours spec
implementation.
Implementation I came up with:
https://github.com/gojuno/lostgis/blob/master/sql/types/type_opening_hours.sql

Spec:
https://wiki.openstreetmap.org/wiki/Key:opening_hours

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ildar Musin 2018-01-12 10:57:27 Minor fix for pgbench documentation
Previous Message Amit Khandekar 2018-01-12 10:12:29 Re: [HACKERS] UPDATE of partition key