Re: simple division

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: simple division
Date: 2018-12-05 11:05:49
Message-ID: CAEzk6ffEqKAcyin0OG5FoW=ayP0Pz8O2EFi8gKjv7qcSLQ7nVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 5 Dec 2018 at 09:13, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Withers 2018-12-05 11:37:27 Re: surprising query optimisation
Previous Message Allan Kamau 2018-12-05 09:59:12 Re: Geographic coordinate values format conversion to DD (Decimal Degrees) format