Re: int4 <-> bool casts - Mailing list pgsql-patches

From Neil Conway
Subject Re: int4 <-> bool casts
Date
Msg-id 422266B2.6070206@samurai.com
Whole thread Raw
In response to int4 <-> bool casts  (Neil Conway <neilc@samurai.com>)
Responses Re: int4 <-> bool casts
List pgsql-patches
Peter Eisentraut wrote:
> - Casting back and forth does not preserve information.  (This may be
> true for some other type pairs as well, but in this case it's true in
> almost every instance.)

Right, there are many other explicit casts that lose information. In
fact, I think that's somewhat the point of an explicit cast -- if a cast
didn't lose information, it could be done implicitly. By explicitly
casting something, the user is acknowledging that they accept the
possibility of lost information.

> - It's an arbitary definition that is not obviously supported by
> mathematical or similar principles.

It has a long standing precedent outside of mathematics, such as in C
and derived programming languages.

-Neil

pgsql-patches by date:

Previous
From: Simon Riggs
Date:
Subject: Re: A way to let Vacuum warn if FSM settings are low.
Next
From: Peter Eisentraut
Date:
Subject: Re: int4 <-> bool casts