Re: Problem with numeric and operators

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Problem with numeric and operators
Дата
Msg-id 200109041233.f84CXw8s008279@linda.lfix.co.uk
обсуждение исходный текст
Ответ на Problem with numeric and operators  (DaVinci <bombadil@wanadoo.es>)
Список pgsql-general
DaVinci wrote:
  > Hi all.
  >
  > I have a problem with data type 'numeric'. If I have a field of type
  > 'numeric' (in this case 'foo') and execute next query:
  >
  >     select * from table_example where foo > 2.45
  >
  > I get error:
  >
  >     ERROR:  Unable to identify an operator '>' for types 'numeric' and 'flo
      >at8'
  >    You will have to retype this query using an explicit cast
  >
  > What is the meaning of this? Is it a bug? What am I doing wrong?...

There is not yet an automatic type conversion for such cases.

Add an explicit cast to your query:

  select * from table_example where foo > CAST (2.45 AS NUMERIC(12,2))


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "If any of you lack wisdom, let him ask of God, who
      gives to all men generously and without reproach, and
      it will be given to him."           James 1:5



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

Предыдущее
От: DaVinci
Дата:
Сообщение: Problem with numeric and operators
Следующее
От: "Hartwig Jens"
Дата:
Сообщение: Book "PostgreSQL" to be released in November 2001