From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | cast bytea to/from bit strings |
Date: | 2006-05-04 15:10:11 |
Message-ID: | Pine.LNX.4.64.0605041702220.4645@briare.cri.ensmp.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Dear PostgreSQL developers,
Please find attached a small patch to convert bytea to bit strings and
vice versa.
I used it in order to be able xor md5 results so as to checksum bundles of
tuples together. The MD5 result is an hexa text convertible to bytea with
decode, but then I was stuck...
ISTM that having these types explicitely castable may be useful to others,
hence this small contribution. The cast allows to work on a bytea at the
bit level and to perform bitwise operations.
./src/backend/utils/adt/varbit.c
- add two conversion functions
./src/include/catalog/pg_proc.h
- declare the above functions in the catalog
./src/include/catalog/pg_cast.h
- declare the 4 explicit casts
./src/test/regress/sql/bit.sql
- test all those new casts
./src/test/regress/expected/bit.out
- new regression results
./src/test/regress/expected/opr_sanity.out
- pg figures out that bit and varbit are binary compatible,
which is the case (well, at least I assumed it).
--
Fabien.
Attachment | Content-Type | Size |
---|---|---|
byteacasts.patch | text/plain | 8.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Sven Suursoho | 2006-05-04 15:21:36 | Re: plpython improvements |
Previous Message | Martijn van Oosterhout | 2006-05-04 13:48:07 | [PATCH] Add support for GnuTLS |