From: Marc G. Fournier <scrappy@postgresql.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
Date: Thu, 1 Sep 2005 17:49:02 -0300 (ADT)
Message-ID: <20050901174341.N1044@ganymede.hub.org> (raw)
In-Reply-To: <15013.1125359379@sss.pgh.pa.us>
References: <20050829201253.X1044@ganymede.hub.org>
<15013.1125359379@sss.pgh.pa.us>
On Mon, 29 Aug 2005, Tom Lane wrote:
> "Marc G. Fournier" <scrappy@postgresql.org> writes:
>> # ALTER TABLE table ALTER COLUMN field1 type boolean;
>> ERROR: column "field1" cannot be cast to type "pg_catalog.bool"
>
>> Should this not work?
>
> No, because there's no built-in cast from smallint to bool. You could
> do something like
>
> ... type boolean using case when field1=0 then false else true end;
'k, I just took a read through the "CREATE CAST" man page, and don't think
I can use that for this, but is there some way I can create a cast for
this, so that we don't have to go through the complete application and
change "VALUES ( 0 );" to "VALUES ( '0' );" ...
Again, from reading the man page, I'm guessing not, but just want to make
sure that I haven't missed anything ...
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: scrappy@postgresql.org, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
In-Reply-To: <20050901174341.N1044@ganymede.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox