Re: casting from integer to boolean

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: casting from integer to boolean
Date: 2008-03-26 23:03:06
Message-ID: 871w5xqead.fsf@patagonia.sebmags.homelinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 26 Mar 2008 22:46:08 +0000,
Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:

[...]

> You could turn the problem around and make the bool columns into ints
> (which should be a simple search-and-replace, I hope) and then write
> something (again hopefully simple) to turn them all back into bools.
> I.e. lots of:

> ALTER TABLE my_table ALTER var_bool TYPE bool USING var_bool::bool;

Yes! Good idea, I think I can collect the names of the tables and
columns with boolean fields and then use that as you say. Thanks
everybody.

--
Seb

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2008-03-26 23:11:16 Re: Survey: renaming/removing script binaries (createdb, createuser...)
Previous Message Tom Lane 2008-03-26 22:55:53 Re: casting from integer to boolean