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

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, Postgresql <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: [GENERAL] Update of bitmask type
Date: 1999-09-24 14:21:20
Message-ID: 37EB88E0.24A45661@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> A second problem I encountered last night is that the postgres variable
> length types only allow for the length of an array to be stored in
> bytes. This means that the number of bits will automatically always be
> rounded up to the nearest factor of 8, i.e. you want tp store 3 bits and
> you get 8. For ordering and output this is not always going to produce
> the correct output, as the bitstrings will get zero-padded. Is there
> anywhere else where one could store the exact length of a bit string?

attypmod has been modified recently to contain two fields (each of 16
bits) in a backward-compatible way. It can hold the size *and*
precision of the numeric data types, and presumably should be used in
a similar manner for your bit type.

The problem is that you need another field which contains a length in
bit units. Assuming that the second field in attypmod can't be used
for this purpose, then istm that you will want to add a field to the
data type itself. The character types have:

length - total size of data, in bytes (4 bytes)
data - body

and you might have

length - total size of data, in bytes (4 bytes)
blen - total size of data, in bits (4 bytes)
data - body

- Thomas

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adriaan Joubert 1999-09-24 15:27:36 Re: [HACKERS] Re: [GENERAL] Update of bitmask type
Previous Message José Soares 1999-09-24 13:01:19 Re: [HACKERS] Re: [GENERAL] Update of bitmask type

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-24 14:26:54 Re: [HACKERS] Frustration
Previous Message José Soares 1999-09-24 13:19:52 Re: [HACKERS] create rule changes table to view ?