From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: cast bytea to/from bit strings |
Date: | 2006-05-06 02:33:36 |
Message-ID: | 200605060233.k462Xac03591@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I am not sure this is of general enough usefulness to be in the backend.
Can you add it as a pgfoundry project?
---------------------------------------------------------------------------
Fabien COELHO wrote:
>
> 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.
Content-Description:
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-05-06 02:52:03 | Re: current version: Patch - Have psql show current values |
Previous Message | Bruce Momjian | 2006-05-06 02:26:01 | Re: be-secure.c patch |