From: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: [HACKERS] ALTER TABLE ( smallinto -> boolean ) ... |
Date: | 2005-09-01 21:15:25 |
Message-ID: | 20050901180607.V1044@ganymede.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
Moved off of -hackers, since its long gotten out of that realm :)
On Thu, 1 Sep 2005, Tom Lane wrote:
> "Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
>> On Mon, 29 Aug 2005, Tom Lane wrote:
>>> No, because there's no built-in cast from smallint to bool.
>
>> 'k, I just took a read through the "CREATE CAST" man page, and don't think
>> I can use that for this,
>
> Sure you can. Make a SQL or PLPGSQL function that does the conversion
> you want and then create a cast using it.
Ah, okay, I just re-read the man page and think I stumbled upon what I
overlooked the first time ...
all I want to do is:
CREATE CAST ( 0 AS boolean )
WITH FUNCTION <I have to create this>
AS ASSIGNMENT;
And then each time I try to insert a '0' into a BOOLEAN field, it will
auto convert that (based on my function) to 'f' ...
And I'd need to do a second one for 1 -> 't' ...
Am I reading it right this time ... ?
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-09-01 21:16:48 | Re: rename constraint behavior for duplicate names? |
Previous Message | Martijn van Oosterhout | 2005-09-01 21:14:25 | Re: Using multi-locale support in glibc |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2005-09-01 21:23:08 | Re: ALTER TABLE ( smallinto -> boolean ) ... |
Previous Message | Tom Lane | 2005-09-01 20:56:45 | Re: ALTER TABLE ( smallinto -> boolean ) ... |