------=_Part_14344_21844276.1207649000190
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Tue, Apr 8, 2008 at 7:58 PM, Shoaib Mir <shoaibmir@[EMAIL PROTECTED]
> wrote:
> On Tue, Apr 8, 2008 at 7:54 PM, A B <gentosaker@[EMAIL PROTECTED]
> 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
shoaibm@[EMAIL PROTECTED]
text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<br><br>
<div class="gmail_quote">On Tue, Apr 8, 2008 at 7:58 PM, Shoaib Mir <<a
href="mailto:shoaibmir@[EMAIL PROTECTED]
">shoaibmir@[EMAIL PROTECTED]
>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px
0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="gmail_quote">On Tue, Apr 8, 2008 at 7:54 PM, A B <<a
href="mailto:gentosaker@[EMAIL PROTECTED]
"
target="_blank">gentosaker@[EMAIL PROTECTED]
>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px
0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br>Is there a way to make
postgresql to automatically convert integer<br>values to
boolean?<br><br>Consider<br>
<br>create table x (a boolean);<br>insert into x (a) values
(1);<br><br>the inser fails :-(<br>Is there a way to make it work without
altering the insert command?<br><font color="#888888"></font></blockquote>
<div> </div>
<div> </div></div></blockquote>
<div> </div>
<div>Try using this:</div>
<div> </div>
<div>create table x (a boolean);<br>insert into x (a) values
(1::boolean);</div>
<div> </div>
<div>It worked for me in 8.3</div>
<div> </div>
<div>--</div>
<div>Shoaib Mir</div>
<div>Fujitsu Australia Software Technology</div>
<div><a
href="mailto:shoaibm@[EMAIL PROTECTED]
">shoaibm@[EMAIL PROTECTED]
></div></div>
------=_Part_14344_21844276.1207649000190--


|