Re: ALTER TABLE ( smallinto -> boolean ) ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
Date: 2005-09-01 21:30:42
Message-ID: 6793.1125610242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-01 21:49:12 Re: Using multi-locale support in glibc
Previous Message Tom Lane 2005-09-01 21:25:28 Re: [HACKERS] ALTER TABLE ( smallinto -> boolean ) ...

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2005-09-01 22:16:38 Re: ALTER TABLE ( smallinto -> boolean ) ...
Previous Message Tom Lane 2005-09-01 21:25:28 Re: [HACKERS] ALTER TABLE ( smallinto -> boolean ) ...