Skip site navigation (1) Skip section navigation (2)

Re: boolean as 0 and 1

From: Aarni Ruuhimäki <aarni(at)kymi(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: boolean as 0 and 1
Date: 2008-04-08 10:06:13
Message-ID: 200804081306.13727.aarni@kymi.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tuesday 08 April 2008 12:54, A B wrote:
> Hi,
> Is there a way to make postgresql to automatically convert integer
> values to boolean?
>
> Consider
>
> create table x (a boolean);
> insert into x (a) values (1);
>
> the inser fails :-(
> Is there a way to make it work without altering the insert command?

Hi,

testing=# ALTER TABLE bar ADD a_boolean boolean;
ALTER TABLE
testing=# INSERT INTO bar (a_boolean) VALUES ('1');
INSERT 9459039 1


-- 
Aarni Ruuhimäki
---
Burglars usually come in through your windows.
---

In response to

pgsql-novice by date

Next:From: Francois CoteDate: 2008-04-08 11:37:03
Subject: Re: Problem with data storage
Previous:From: Shoaib MirDate: 2008-04-08 10:03:20
Subject: Re: boolean as 0 and 1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group