ALTER TABLE ( smallinto -> boolean ) ...

From: "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ALTER TABLE ( smallinto -> boolean ) ...
Date: 2005-08-29 23:15:41
Message-ID: 20050829201253.X1044@ganymede.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql


I have a table with several 'smallint' fields that I'd like to convert to
booleean ... the data in each is either 0 or 1, and:

# select '1'::boolean;
bool
------
t
(1 row)
# select '0'::boolean;
bool
------
f
(1 row)

so they do cast as expected ... but, if I try to do the ALTER, I get:

# ALTER TABLE table ALTER COLUMN field1 type boolean;
ERROR: column "field1" cannot be cast to type "pg_catalog.bool"

Should this not work? If not, is there a way to do it so that it will,
without having to reload the whole table?

Thanks ...

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2005-08-29 23:24:45 Re: ALTER TABLE ( smallinto -> boolean ) ...
Previous Message Martijn van Oosterhout 2005-08-29 22:56:21 Simple tester for MVCC in PostgreSQL

Browse pgsql-sql by date

  From Date Subject
Next Message David Fetter 2005-08-29 23:24:45 Re: ALTER TABLE ( smallinto -> boolean ) ...
Previous Message Michael Fuhr 2005-08-29 23:10:37 Re: sqlstate 02000 while declaring cursor/freeing prepared