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

Re: [SQL] Urgent help in bit_string data type

From: Joe <dev(at)freedomcircle(dot)net>
To: Karthikeyan Sundaram <skarthi98(at)hotmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Urgent help in bit_string data type
Date: 2007-04-11 21:44:01
Message-ID: 1176327841.782.2.camel@pampa (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-sql
Hi skarthi,

On Wed, 2007-04-11 at 13:30 -0700, Karthikeyan Sundaram wrote:
>         insert into test_a values (to_char(1,'9'));
>          
>         ERROR:  column "b" is of type bit but expression is of type
>         text
>         HINT:  You will need to rewrite or cast the expression.

As suggested by the error, you should use a cast, e.g.,

    insert into test_a values 9::bit(3);

This will result in binary '001' being inserted because you need 4 bits
to represent decimal 9.

Joe


In response to

pgsql-admin by date

Next:From: Karthikeyan SundaramDate: 2007-04-11 22:01:07
Subject: Re: [SQL] Urgent help in bit_string data type
Previous:From: Chris HooverDate: 2007-04-11 21:02:12
Subject: Re: Best compressed archive_command on Linux?

pgsql-sql by date

Next:From: Karthikeyan SundaramDate: 2007-04-11 22:01:07
Subject: Re: [SQL] Urgent help in bit_string data type
Previous:From: Karthikeyan SundaramDate: 2007-04-11 20:30:57
Subject: Urgent help in bit_string data type

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