Thread

  1. Re: Bit strings

    Adriaan Joubert <a.joubert@albourne.com> — 2000-06-09T06:00:57Z

    Bruce Momjian wrote:
    
    > Can we get the BIT type working now that 7.1 is branched?
    >
    
    Yep. We never quite finished the discussions before the 7.0 release. The
    outstanding issues were
    
    1) should bit operations be allowed between bit strings of different sizes?
    They are at the moment, but the longest string is truncated, as you
    otherwise get illogical behaviour (imagine padding with zeros and doing an
    XOR). Truncation can be somewhat unlogical as well. My current feeling is
    that perhaps it would be better to just disallow bit operations on
    bitstrings that haven't got the same length completely. Makes the code
    easier anyway ;-)
    
    2) A second point brought up by Peter is the conversion of bit-strings to
    integers and vice-versa. Postgres does not have unsigned ints, so it can
    lead to somewhat surprising behaviour. Implicit conversion is probably out
    of the question. So what type of conversion functions would people like to
    see, if any?
    
    3) With TOAST bit strings could be used to store large amounts of binary
    data. Don mentioned MIME-encoded strings for I/O. Is this useful? I guess
    and advantage is that BIT is an SQL type, but I'm not sure that any such
    application would be particularly portable. It doesn't look like a lot of
    extra work though, (provided somebody has got some MIME en-/decoding code
    lying about) so we could add it. Am i right that with TOAST and no
    restrictions on the query-buffer lengths in psql one could then upload mime
    objects straight into postgres?
    
    So, what do people think?
    
    Adriaan