Re: Cast Problem

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Cast Problem
Дата
Msg-id 20050811213057.GA95048@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: Cast Problem  (<operationsengineer1@yahoo.com>)
Список pgsql-novice
On Thu, Aug 11, 2005 at 02:14:03PM -0700, operationsengineer1@yahoo.com wrote:
> Warning: pg_exec(): Query failed: ERROR: Cannot cast
> type character varying to integer in
> /home/home/adodb/drivers/adodb-postgres64.inc.php on
> line 741
> -1: ERROR: Cannot cast type character varying to
> integer

The error tells you what's wrong: the database doesn't know how to
cast a varchar to an integer.  A way around that is to cast the
varchar value to text and then to integer, like this:

ORDER BY serial_number::text::integer;

> it there is no error in 7.4.

That's odd -- 7.4.8 gives me the same "cannot cast type character
varying to integer" error as 7.3.10.  8.0.3 works because 8.0 added
the necessary casts.  You can use "\dC" in psql to see what casts
are available.

--
Michael Fuhr

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

Предыдущее
От:
Дата:
Сообщение: Re: Cast Problem - varchar() problem
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Forcing WAL switch