Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > Re: boolean as ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 3066 of 3255
Post > Topic >>

Re: boolean as 0 and 1

by shoaibmir@[EMAIL PROTECTED] ("Shoaib Mir") Apr 8, 2008 at 08:03 PM

------=_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 &lt;<a
href="mailto:shoaibmir@[EMAIL PROTECTED]
">shoaibmir@[EMAIL PROTECTED]
>&gt; 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 &lt;<a
href="mailto:gentosaker@[EMAIL PROTECTED]
"
target="_blank">gentosaker@[EMAIL PROTECTED]
>&gt; 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>&nbsp;</div>
<div>&nbsp;</div></div></blockquote>
<div>&nbsp;</div>
<div>Try using this:</div>
<div>&nbsp;</div>
<div>create table x (a boolean);<br>insert into x (a) values
(1::boolean);</div>
<div>&nbsp;</div>
<div>It worked for me in 8.3</div>
<div>&nbsp;</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--
 




 4 Posts in Topic:
boolean as 0 and 1
gentosaker@[EMAIL PROTECT  2008-04-08 11:54:09 
Re: boolean as 0 and 1
shoaibmir@[EMAIL PROTECTE  2008-04-08 19:59:15 
Re: boolean as 0 and 1
shoaibmir@[EMAIL PROTECTE  2008-04-08 20:03:20 
Re: boolean as 0 and 1
aarni@[EMAIL PROTECTED]   2008-04-08 13:06:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 6:22:02 CDT 2008.