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

From Tom Lane
Subject Re: ALTER TABLE ( smallinto -> boolean ) ...
Date
Msg-id 6793.1125610242@sss.pgh.pa.us
Whole thread Raw
In response to Re: ALTER TABLE ( smallinto -> boolean ) ...  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: ALTER TABLE ( smallinto -> boolean ) ...
List pgsql-hackers
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.

> Is there a way to make the builtin int to bool cast implicit?

I think you'd have to go and hack the pg_cast entry ... but that cast is
new in 8.1 anyway, so it doesn't apply to Marc's problem (yet).

If we want to make it cover that specific scenario, changing it to AS
ASSIGNMENT would be sufficient; I don't think it needs to be IMPLICIT.
(I generally find cross-type-category implicit casts to be dangerous.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
Next
From: Tom Lane
Date:
Subject: Re: Using multi-locale support in glibc