Re: interesting difference for queries...

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Re: interesting difference for queries...
Дата
Msg-id 1039020201.35854.48.camel@jester
обсуждение исходный текст
Ответ на interesting difference for queries...  ("Mario Weilguni" <mario.weilguni@icomedias.com>)
Ответы Re: interesting difference for queries...  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, 2002-12-04 at 11:21, Mario Weilguni wrote:
> I noticed an interesting difference in query behaviour:
>
> cms=# CREATE TABLE foo(bar int);
> CREATE
> cms=# SELECT * from foo where bar=1.7;

This is a numeric to integer coercion, which rounds

rbt=# select 1.7::int;int4
------   2
(1 row)

>  bar
> -----
> (0 rows)
>
> cms=# SELECT * from foo where bar='1.7';
> ERROR:  pg_atoi: error in "1.7": can't parse ".7"

This is a text to integer coercion, which doesn't round.


I guess the question is whether or not a numeric -> integer conversion
should 'wedge' numbers into the int, or throw an error.

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] PostgreSQL Global Development Group Announces
Следующее
От: Lee Kindness
Дата:
Сообщение: Re: PQnotifies() in 7.3 broken?