Re: Behavior of CAST to integer - Mailing list pgsql-novice

From David G Johnston
Subject Re: Behavior of CAST to integer
Date
Msg-id CAKFQuwaE48Jn-3pV5TZ3=f_uQm+9A_PHvtWfaeW+fHwcE-ixgA@mail.gmail.com
Whole thread Raw
In response to Re: Behavior of CAST to integer  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
List pgsql-novice
You need the floor operator:

​floor() behaves identically to trunc() for positive numbers only; for negative numbers floor() will round away from zero while trunc() rounds toward zero.​  ceil() or ceiling() has the same dual-behavior - though in reverse compared to floor() - for positive/negative numbers.

David J.



 


View this message in context: Re: Behavior of CAST to integer
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

pgsql-novice by date:

Previous
From: byron509
Date:
Subject: Re: Behavior of CAST to integer
Next
From: Bruce Momjian
Date:
Subject: Re: Restrict number of connections to specific table