cannot cast bpchar and varchar

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема cannot cast bpchar and varchar
Дата
Msg-id 199902100243.LAA24610@srapc451.sra.co.jp
обсуждение исходный текст
Список pgsql-hackers
It seems that casting varchar and bpchar does not work.

I create two tables.

create table main (id char(4), sub_id char(4), caption char(10));
create table sub (sub_id varchar(10), sub_caption varchar(10));

Then do a select.

select main.id, sub.sub_caption, main.caption from main, subwhere main.sub_id=sub.sub_id;

I get an error(this is normal, I guess).

ERROR:  There is more than one possible operator '=' for types 'bpchar' and 'varchar'You will have to retype this query
usingan explicit cast
 

So I try some castings.

test=> select main.id, sub.sub_caption, main.caption from main, sub where main.sub_id::varchar =sub.sub_id;
test=> ERROR:  There is more than one possible operator '=' for types 'bpchar' and 'varchar'You will have to retype
thisquery using an explicit cast
 
test=> select main.id, sub.sub_caption, main.caption from main, sub where main.sub_id=sub.sub_id::bpchar;
ERROR:  There is more than one possible operator '=' for types 'bpchar' and 'varchar'You will have to retype this query
usingan explicit cast
 
test=> select main.id, sub.sub_caption, main.caption from main, sub where cast(main.sub_id as varchar) =sub.sub_id;
ERROR:  There is more than one possible operator '=' for types 'bpchar' and 'varchar'You will have to retype this query
usingan explicit cast
 
test=> select main.id, sub.sub_caption, main.caption from main, sub where main.sub_id=cast(sub.sub_id as bpchar);
ERROR:  There is more than one possible operator '=' for types 'bpchar' and 'varchar'You will have to retype this query
usingan explicit cast
 

Do we have a problem with casting? BTW, this is 6.4.2. I have not
tried current yet.
--
Tatsuo Ishii


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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Keywords
Следующее
От: "Daryl W. Dunbar"
Дата:
Сообщение: PostgreSQL and Solaris 7?