Re: BUG #15071: Error in PostgreSQL-specific :: type cast
| От | Francisco Olarte |
|---|---|
| Тема | Re: BUG #15071: Error in PostgreSQL-specific :: type cast |
| Дата | |
| Msg-id | CA+bJJbxJuBag4+gW+nTJkuL=-ic+8fO5kdcip3KeEL-nBQ5K5A@mail.gmail.com обсуждение исходный текст |
| Ответ на | BUG #15071: Error in PostgreSQL-specific :: type cast (PG Bug reporting form <noreply@postgresql.org>) |
| Список | pgsql-bugs |
On Fri, Feb 16, 2018 at 12:57 PM, PG Bug reporting form <noreply@postgresql.org> wrote: ... > SELECT -32768::smallint > ^ERROR: smallint out of range This is interpreted as -(32768::smallint) ... > Standard-syntax type casts are workes correctly: > SELECT cast(-32768 as smallint) This is not. When in doubt, put parenthesis postgres=# select (-32768)::smallint; int2 -------- -32768 (1 row) postgres=# select -(32768::smallint); ERROR: smallint out of range postgres=# select -32768::smallint; ERROR: smallint out of range And IIRC, expression with implicit casts ( like when comparing constnat to columns) work because they use the conversion from text/unknown... postgres=# select '-32768'::smallint; int2 -------- -32768 (1 row) Francisco Olarte.
В списке pgsql-bugs по дате отправления: