Re: How do I...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How do I...
Дата
Msg-id 3243.986178125@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: How do I...  (Paul Tomblin <ptomblin@xcski.com>)
Список pgsql-general
Paul Tomblin <ptomblin@xcski.com> writes:
> How do I compare a char (bpchar?) to a varchar?  I tried using "=", and I
> got:

>     waypoint=> select b.id, a.icao,a.faa_host_id from dafif_arpt a, waypoint b
>     where b.id = a.icao;
>     ERROR:  Unable to identify an operator '=' for types 'varchar' and 'bpchar'
>             You will have to retype this query using an explicit cast

> Why isn't this working?

char and varchar are not directly comparable because they have different
ideas about whether trailing blanks are significant.  Postgres makes you
cast one or the other so that it knows which set of comparison rules to
apply.  Typically you probably want to cast the varchar side to char so
that trailing blanks are ignored.

> It doesn't work even if I try to cast the varchar to bpchar:

I believe you are also running into sundry bugs in 6.5's handling of
these casts.  Should be cleaned up in 7.0.*.

            regards, tom lane

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

Предыдущее
От: Murakami
Дата:
Сообщение: pg_ctl stop returns error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_ctl stop returns error