ERROR: cannot cast type text to bit varying

Поиск
Список
Период
Сортировка
От Matt Miller
Тема ERROR: cannot cast type text to bit varying
Дата
Msg-id 1118347502.3596.32.camel@dbamm01-linux
обсуждение исходный текст
Ответы Re: ERROR: cannot cast type text to bit varying
Re: ERROR: cannot cast type text to bit varying
Список pgsql-general
I'm trying to interpret strings of Y's and N's as bit vectors and
perform bitwise ops on them.  It's not working:

========beginning of output=============================
test=# select version ();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-49)
(1 row)

test=# select translate ('YNNY', 'YN', '10')::bit varying & translate
('NYYN', 'YN', '10')::bit varying;
ERROR:  cannot cast type text to bit varying
========end of output=============================

It's curious to me that the following is fine:

========beginning of output=============================
test=# select '1001'::bit varying;
 varbit
--------
 1001
(1 row)
========end of output=============================

As what data type is the literal '1001' being treated, that it can be
cast to bit varying, while text data (e.g. the result of "translate")
cannot be so cast?

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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: monetary data
Следующее
От: Matt Miller
Дата:
Сообщение: Re: ERROR: cannot cast type text to bit varying