pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe <dev@freedomcircle.net>
To: Karthikeyan Sundaram <skarthi98@hotmail.com>
Cc: pgsql-admin@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Urgent help in bit_string data type
Date: Wed, 11 Apr 2007 17:44:01 -0400
Message-ID: <1176327841.782.2.camel@pampa> (raw)
In-Reply-To: <BAY131-W10EF789544B96131E8A482B05F0@phx.gbl>
References: <BAY131-W10EF789544B96131E8A482B05F0@phx.gbl>

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




view thread (6+ messages)  latest in thread

Message-ID: <1176327841.782.2.camel@pampa>
Permalink:  ../1176327841.782.2.camel@pampa/
Also on:    postgresql.org/message-id/1176327841.782.2.camel@pampa

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@freedomcircle.net, skarthi98@hotmail.com, pgsql-admin@postgresql.org
  Subject: Re: [SQL] Urgent help in bit_string data type
  In-Reply-To: <1176327841.782.2.camel@pampa>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox