Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B20239FB55E; Wed, 11 Apr 2007 18:44:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 36474-03; Wed, 11 Apr 2007 18:44:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id 81EE29FB54B; Wed, 11 Apr 2007 18:44:09 -0300 (ADT) Received: from [192.168.7.5] ([71.101.4.76]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JGC00GTSSDHCZQE@vms046.mailsrvcs.net>; Wed, 11 Apr 2007 16:44:08 -0500 (CDT) Date: Wed, 11 Apr 2007 17:44:01 -0400 From: Joe Subject: Re: [SQL] Urgent help in bit_string data type In-reply-to: To: Karthikeyan Sundaram Cc: pgsql-admin@postgresql.org, pgsql-sql@postgresql.org Message-id: <1176327841.782.2.camel@pampa> Organization: Freedom Circle, LLC MIME-version: 1.0 X-Mailer: Evolution 2.10.0 FreeBSD GNOME Team Port Content-type: text/plain Content-transfer-encoding: 7bit References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/104 X-Sequence-Number: 25168 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