Bit-wise foreign keys

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Bit-wise foreign keys
Дата
Msg-id F9331D12-DD94-4A5E-81CC-A1AED3676058@solfertje.student.utwente.nl
обсуждение исходный текст
Ответы Re: Bit-wise foreign keys  (Steve Atkins <steve@blighty.com>)
Список pgsql-general
Hey all,

I'm tossing an idea around again, namely using bit positions and values as foreign key references. Let's start with a
bitof background information: 

I'm currently parsing a log-file that I want to apply all kinds of statistical analysis to. This file contains lines of
recordsof data, among which are some bytes of which each bit marks a certain truth-value. As an internal data-object
that'sjust dandy, but presenting it to, for example a user, or to query it for certain masks without having to delve
intothe definition of that particular bit-field it would be great to have a textual representation of each bit. 

Let's say we have this byte, with the attached meanings:
  pos  meaning
   0   RED    (least significant bit)
   1   GREEN
   2   BLUE
   3   FIRE
   4   WATER
   5   EARTH
   7   AIR    (most significant bit)

Now if I see a value of 0x05, I know that this corresponds to [RED, FIRE] and if I have a value of 0x41 I know that I'm
introuble as there's a bit set that has no meaning! 

Reeks of a foreign key constraint, doesn't it? An odd one though, as one value can contain multiple bits and thus
referencesmultiple foreign values... 

Do we have anything for this yet? If not, would this be a good feature?
I imagine something similar could be done for (fixed-length?) arrays too...

Of course something like this would benefit from some convenience functions; you wouldn't really want to get multiple
recordsfor the same row with different bits matched - something like bit_accum() to turn the separate results into an
arraywould be useful I think. 

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4c97949110251883445726!



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

Предыдущее
От: Dmitriy Igrishin
Дата:
Сообщение: Re: Data directory permissions.
Следующее
От: Chris Browne
Дата:
Сообщение: Re: Binary Replication and Slony