Skip site navigation (1) Skip section navigation (2)

Re: int4 <-> bool casts

From: Neil Conway <neilc(at)samurai(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: int4 <-> bool casts
Date: 2005-02-28 00:32:50
Message-ID: 422266B2.6070206@samurai.com (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-patches by date

Next:From: Neil ConwayDate: 2005-02-28 03:44:53
Subject: Re: array max() / min()
Previous:From: Peter EisentrautDate: 2005-02-28 00:24:55
Subject: Re: int4 <-> bool casts

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group