Re: ALTER TABLE ( smallinto -> boolean ) ... - Mailing list pgsql-hackers

From Marc G. Fournier
Subject Re: ALTER TABLE ( smallinto -> boolean ) ...
Date
Msg-id 20050901191422.K1044@ganymede.hub.org
Whole thread Raw
In response to Re: ALTER TABLE ( smallinto -> boolean ) ...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, 1 Sep 2005, Tom Lane wrote:

> Andrew Dunstan <andrew@dunslane.net> writes:
>> Tom Lane wrote:
>>> Sure you can.  Make a SQL or PLPGSQL function that does the conversion
>>> you want and then create a cast using it.
>
>> That probably won't help him much with "values(0)":
>
> If I remember the context of the original request, it wasn't about that
> anyway, but about dealing with an existing smallint column.

Nope, actually, the original was to just convert an existing table from 
using smallint->boolean, but what I'm looking at with the CREATE CAST is 
to avoid reducing the # of changes that I have to make to the existing 
application, so being able to auto-cast 0->'f' on an INSERT/UPDATE would 
help wtih that ...

The app still needs to be fixed, but this would allow for the initial 
change to be made a bit easier ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PL/pgSQL: EXCEPTION NOSAVEPOINT
Next
From: Matt Miller
Date:
Subject: Re: PL/pgSQL: EXCEPTION NOSAVEPOINT