RE: Direct converting numeric types to bool - Mailing list pgsql-hackers

From Alex Ignatov
Subject RE: Direct converting numeric types to bool
Date
Msg-id [email protected]
Whole thread Raw
In response to Direct converting numeric types to bool  ([email protected])
Responses Re: Direct converting numeric types to bool
List pgsql-hackers
-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: Wednesday, February 28, 2018 6:04 PM
To: pgsql-hackers <[email protected]>
Subject: Direct converting numeric types to bool

Attached patch allow direct convertion of numeric types to bool like
integer::bool.
Supported types:
  - smallint;
  - bigint;
  - real;
  - double precision;
  - decimal(numeric).

This functionality is helped with migration from Oracle.

--
Nikita Zhuchkov
Postgres Professional: http://www.postgrespro.com The Russian Postgres
Company

Hello!

What prevent us from:

postgres=# select 1::bigint::int::boolean;
 bool
------
 t
(1 row)

It is just one additional casting and required no additional patching
--
Alex Ignatov 
Postgres Professional: http://www.postgrespro.com 
The Russian Postgres Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: postgres_fdw: perform UPDATE/DELETE .. RETURNING on a join directly
Next
From: Nikhil Sontakke
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions