char/varchar conversions

Поиск
Список
Период
Сортировка
От Peter Haworth
Тема char/varchar conversions
Дата
Msg-id 200011151312.eAFDCks03783@mail.postgresql.org
обсуждение исходный текст
Ответы Re: char/varchar conversions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I'm having trouble getting Postgres 6.5.3 to do what I want. The problem seems
to be fixed in version 7, but I could really do with a workaround for 6.5.3,
since I'm stuck with that for the time being.

journals2=> create table vc(v varchar(9), c char(9));
CREATE
journals2=> insert into vc values('abc','abc');
INSERT 1631143 1
journals2=> select * from vc where v::char(9)=c;
ERROR:    Unable to identify an operator '=' for types 'varchar' and 'bpchar'
    You will have to retype this query using an explicit cast

Surely I did use an explicit cast? The same thing happens whether I cast one
side or the other or both. Let's try being sneakier:

journals2=> select * from vc where v::text::varchar=c::text::varchar;
pqReadData() -- backend closed the channel unexpectedly.
    This probably means the backend terminated abnormally
    before or while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

That's obviously too sneaky.

--
    Peter Haworth    pmh@edison.ioppublishing.com
Anything that can go wrong, will go wr



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

Предыдущее
От: "Martin A. Marques"
Дата:
Сообщение: Re: PHPBuilder article -- Postgres vs MySQL
Следующее
От: "carl garland"
Дата:
Сообщение: Re: [HACKERS] Re: PHPBuilder article -- Postgres vs MySQL