varbit functions

Поиск
Список
Период
Сортировка
От TJ O'Donnell
Тема varbit functions
Дата
Msg-id 424ECE16.1040101@acm.org
обсуждение исходный текст
Список pgsql-general
I'm using bit and bit varying datatypes to store chemical
"fingerprints" and need various functions to operate on
these datatypes.  The logical operators (and, or, not)
and the shift operators, as well as length and octet-length
all work fine on bit types.  I was hoping for a manual entry
that specifically discusses functions for bit and bit varying,
like the one for dates, strings, etc.  Does anyone know of such
a manual entry?  I see bits (no pun intended) of info scattered
around.  \df helps some too.  I'll consider writing such an entry
unless someone can point me to something existing.

So, the functions I need are (at least):

int  nbits_set(bit)    ;to count # of bits set in the string.
void bit_set(bit, int) ;to set a particular bit in a string.
bool isbit_set(bit)    ;to test whether a particular bit is set.

I've already written nbits_set (in c) and could write the others,
but I want to ask if functions like these already exist (and I
just can't find them)?  Does anyone have any ideas about how to
use combinations of existing functions (shifts, ands, etc.) to do
these functions?  The bit strings I am interested in range from
20 to maybe 1024.

TJ

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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Debugging deadlocks
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Loosing connection with the database