Re: boolean as 0 and 1 - Mailing list pgsql-novice

From Shoaib Mir
Subject Re: boolean as 0 and 1
Date
Msg-id bf54be870804080303n6927854bpf62299e6ab85c511@mail.gmail.com
Whole thread Raw
In response to boolean as 0 and 1  ("A B" <gentosaker@gmail.com>)
List pgsql-novice


On Tue, Apr 8, 2008 at 7:58 PM, Shoaib Mir <shoaibmir@gmail.com> wrote:
On Tue, Apr 8, 2008 at 7:54 PM, A B <gentosaker@gmail.com> 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?
 
 
 
Try using this:
 
create table x (a boolean);
insert into x (a) values (1::boolean);
 
It worked for me in 8.3
 
--
Shoaib Mir
Fujitsu Australia Software Technology

pgsql-novice by date:

Previous
From: "Shoaib Mir"
Date:
Subject: Re: boolean as 0 and 1
Next
From: Aarni Ruuhimäki
Date:
Subject: Re: boolean as 0 and 1