From: | Peter Hunsberger <peter(dot)hunsberger(at)gmail(dot)com> |
---|---|
To: | Howard Rogers <hjr(at)diznix(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Bitmask trickiness |
Date: | 2010-07-22 14:35:08 |
Message-ID: | AANLkTin8IcR9IsH9f0p-edWWceCAOnahkAYGnoO8HKzl@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jul 21, 2010 at 11:13 PM, Howard Rogers <hjr(at)diznix(dot)com> wrote:
>
> On Thu, Jul 22, 2010 at 1:02 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
>
>
> >>
> >> Why on Earth would I want to store this sort of stuff in a bit string?!
> >
> > Because you are manipulating bits and not integers? I guess there are
> > 10 kinds of people, those who like think in binary and those who
> > don't.
> >
> >> I don't know about you, but I find looking at 21205 a darn'd site
> >> easier than staring blankly at 101001011010101!!
<snip> lots of stuff</snip>
> >
> > Note you can cast integer to bitstring, but there may be some odd
> > behaviour for sign bits and such. Which is again why I'd use the
> > right type for the job, bit string. But it's your project.
> >
>
> Quoting...
>
> > Because you are manipulating bits and not integers? I guess there are
> > 10 kinds of people, those who like think in binary and those who
> > don't.
>
> Er, no. 21205 is not an integer. It's an encoded bit of magic.
>
In that case your database design is fundamentally broken. A database
should have content fields that map to the needs of the application.
As you describe your application requirements, that is a bit string
and not an integer. Use bit strings and your application logic is
transparent, obvious and easy to maintain. Use integers and you have
to resort to "magic". As you say, it's your choice, but you came here
looking for advice and the advice you were given is very good....
--
Peter Hunsberger
From | Date | Subject | |
---|---|---|---|
Next Message | P Kishor | 2010-07-22 14:41:12 | optimizing daily data storage in Pg |
Previous Message | Andreas Joseph Krogh | 2010-07-22 14:15:18 | Clarification of the "simple" dictionary |