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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-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

Browse pgsql-admin by date

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

Browse pgsql-sql by date

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