Re: ERROR: cannot cast type text to bit varying

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: ERROR: cannot cast type text to bit varying
Дата
Msg-id 20050609225406.GA15047@surnet.cl
обсуждение исходный текст
Ответ на Re: ERROR: cannot cast type text to bit varying  (Matt Miller <mattm@epx.com>)
Ответы Re: ERROR: cannot cast type text to bit varying  (Matt Miller <mattm@epx.com>)
Список pgsql-general
On Thu, Jun 09, 2005 at 10:18:27PM +0000, Matt Miller wrote:
> On Thu, 2005-06-09 at 20:05 +0000, Matt Miller wrote:
> > I'm trying to interpret strings of Y's and N's as bit vectors and
> > perform bitwise ops on them.
>
> Well, I ended up writing a bunch of code to accomplish what I initially
> thought would be just some casting and bitops on built-in types.  I
> really thought that the bit string types would help me, but I just
> couldn't get them to work.

I imagine you could have done something involving textout() and
varbit_in(), like

alvherre=# select varbit_in(textout(translate('YYNY', 'YN', '10')), 123::oid, 32);
 varbit_in
-----------
 1101
(1 fila)

The OID parameter is unused, give it anything except NULL.  The integer
is the maximum length of the resulting varbit field.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"La soledad es compañía"

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

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: Version Control?
Следующее
От: elein@varlena.com (elein)
Дата:
Сообщение: Re: Version Control?