Re: Bitmask trickiness

Поиск
Список
Период
Сортировка
От Peter Hunsberger
Тема Re: Bitmask trickiness
Дата
Msg-id AANLkTin8IcR9IsH9f0p-edWWceCAOnahkAYGnoO8HKzl@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bitmask trickiness  (Howard Rogers <hjr@diznix.com>)
Ответы Re: Bitmask trickiness  (Howard Rogers <hjr@diznix.com>)
Список pgsql-general
On Wed, Jul 21, 2010 at 11:13 PM, Howard Rogers <hjr@diznix.com> wrote:
>
> On Thu, Jul 22, 2010 at 1:02 PM, Scott Marlowe <scott.marlowe@gmail.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Andreas Joseph Krogh
Дата:
Сообщение: Clarification of the "simple" dictionary
Следующее
От: P Kishor
Дата:
Сообщение: optimizing daily data storage in Pg