pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc G. Fournier <scrappy@postgresql.org>
To: pgsql-hackers@postgresql.org
Subject: ALTER TABLE ( smallinto -> boolean ) ...
Date: Mon, 29 Aug 2005 20:15:41 -0300 (ADT)
Message-ID: <20050829201253.X1044@ganymede.hub.org> (raw)


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@hub.org           Yahoo!: yscrappy              ICQ: 7615664



view thread (13+ messages)  latest in thread

Message-ID: <20050829201253.X1044@ganymede.hub.org>
Permalink:  ../20050829201253.X1044@ganymede.hub.org/
Also on:    postgresql.org/message-id/20050829201253.X1044@ganymede.hub.org

 · 

reply

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, pgsql-hackers@postgresql.org
  Subject: Re: ALTER TABLE ( smallinto -> boolean ) ...
  In-Reply-To: <20050829201253.X1044@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