Re: [HACKERS] Re: [GENERAL] Update of bitmask type

From: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
To: Postgresql <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: [GENERAL] Update of bitmask type
Date: 1999-10-09 09:22:34
Message-ID: 37FF095A.7DC0841B@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi,

OK, I've finally gotten round to coding most of the functions for bit
strings. I've got I/O, concatenation, substring and all bit operations
(and, or, xor, not, shift) working on the bitstring data structures. A
few (probably pretty daft) questions (if there is documentation on this
somewhere, please point me to it):

1. In the varchar file there are some functions which I believe are for
the conversion of char(n) to char(m). They take as argument a pointer to
a char() and a len which is the length of the total data structure. I
haven't figured out how conversions are implemented within postgres, but
I would need to transfer the equivalent of an atttypmod value, which
would contain the length of the bit string to do the conversions. Does
this fit in with the way the rest of the system works?

char * zpbit (char * arg, int32 bitlen)

2. there is a function _bpchar, which has something to do with arrays,
but I can't see how it fits in with everything else.

3. I need to write a hash function for bitstrings. I know nothing about
hash functions, except that they are hard to do well. I looked at the
function for text hashes and that is some weird code (i.e. it took me a
while to figure out what it did). Does anybody have any suggestions
off-hand for a decent hash function for bit strings? Could I just use
the text hash function? (Seems to me text should be different as it
usually draws from a more restricted range than a bit string).

4. Now that I've got the functionality, can somebody give me a rough
roadmap to what I need to change to turn this into a proper postgres
type? As far as I can see I need to assign oid's to it in pg_type.h and
I'll have to have a look at the parser to get it to recognise the types.
It would be a big help though if somebody could tell me what else needs
to change.

Thanks,

Adriaan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Teege 1999-10-09 09:45:20 Connect PostgreSQL 6.0 Server with php4b
Previous Message Gene Selkov, Jr. 1999-10-09 03:19:18 Re: [GENERAL] btree index on a char(8) field (fwd)

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-10-09 10:20:59 Re: [HACKERS] Re: [GENERAL] Update of bitmask type
Previous Message Bruce Momjian 1999-10-09 02:55:08 Re: [HACKERS] Interesting Quote you might enjoy about PGSQL.