Re: simple division - Mailing list pgsql-general

From Geoff Winkless
Subject Re: simple division
Date
Msg-id CAEzk6ffEqKAcyin0OG5FoW=ayP0Pz8O2EFi8gKjv7qcSLQ7nVg@mail.gmail.com
Whole thread Raw
In response to Re: simple division  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Responses Re: simple division
Re: simple division
List pgsql-general
On Wed, 5 Dec 2018 at 09:13, Gavin Flower <GavinFlower@archidevsys.co.nz> wrote:
> SELECT ceil(10/4.0);
>
> Is what you want for that example.

Except that implies that "number of people who can fit in a car" is a
real number, not a whole.

IMO it's fundamentally broken that SQL doesn't cast the result of a
divide into a numeric value - the potential for unexpected errors
creeping into calculations is huge; however that's the standard and
no-one's going to change it now.

Having said that it's worth noting that those in the Other Place think
that it's broken enough to go against the standard (they have a DIV b
for integer divide and a/b for float).

Geoff


pgsql-general by date:

Previous
From: Allan Kamau
Date:
Subject: Re: Geographic coordinate values format conversion to DD (DecimalDegrees) format
Next
From: Chris Withers
Date:
Subject: Re: surprising query optimisation