Re: Efficient Boolean Storage

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Csaba Nagy <nagy(at)domeus(dot)de>, "'Felipe Schnack'" <felipes(at)ritterdosreis(dot)br>, "'pgsql-general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Efficient Boolean Storage
Date: 2002-12-04 18:39:52
Message-ID: 3DEE4BF8.2DF4EE59@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It is unintuitive to me that the low byte be padded. Shouldn't it be
the high byte?

JLL

Joe Conway wrote:
>
> Csaba Nagy wrote:
> > BTW, is or is not using Postgres a string to store the bit data types ? I
> > have seen a few people asking this on the list, but no straight answer as of
> > yet... the docs really don't mention this aspect.
>
> Use the source ;-)
>
> From varbit.c
>
> /*----------
> * attypmod -- contains the length of the bit string in bits, or for
> * varying bits the maximum length.
> *
> * The data structure contains the following elements:
> * header -- length of the whole data structure (incl header)
> * in bytes. (as with all varying length datatypes)
> * data section -- private data section for the bits data structures
> * bitlength -- length of the bit string in bits
> * bitdata -- bit string, most significant byte first
> *
> * The length of the bitdata vector should always be exactly as many
> * bytes as are needed for the given bitlength. If the bitlength is
> * not a multiple of 8, the extra low-order padding bits of the last
> * byte must be zeroes.
> *----------
> */
>
> Joe
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Gabeler-Lee 2002-12-04 19:00:53 Re: 7.3 no longer using indexes for LIKE queries
Previous Message Yonatan Ben-Nes 2002-12-04 18:32:34 Functions just dont want to work! [hard]