Re: Regarding BITs vs. INTs

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regarding BITs vs. INTs
Date: 2004-02-28 01:20:36
Message-ID: 403FECE4.7070402@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo wrote:
> On Fri, 27 Feb 2004, Bill Moran wrote:
>
>>I hadn't really looked at this until I started having problems with it.
>>
>>For those who haven't been following along, I'm converting an application
>>originally written in MSSQL to Postgres.
>>
>>I'm a little startled by how BIT fields are handled differently. Apparently,
>>MSSQL converts freely between BIT and INT. Those who know, already know that
>>Postgres doesn't do this.
>
> No, but IIRC, it does allow casts between them, it just requires that you
> explicitly mark that you want to cast the value. If you really want to,
> you could consider changing those casts into implicit casts and see if
> that does what you want.

True, and originally that's what I was doing to fix it. For example:

CASE bir_returning_function() WHEN 1 THEN ...

was being changed to:

CASE bit_returning_function() WHEN 1::BIT THEN ...

But, the reason I've stopped to reconsider is the fact that it will take a lot
longer to change all the places that bit_returning_function() is used than it
will to just convert big_returing_function() to return an INT. Some of these
functions are used 20 or 30 different places.

Thanks for the feedback

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2004-02-28 01:33:23 Re: Regarding BITs vs. INTs
Previous Message Stephan Szabo 2004-02-28 01:11:22 Re: Regarding BITs vs. INTs