X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D5DD9D1B191 for ; Fri, 11 Jun 2004 04:54:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72234-03 for ; Fri, 11 Jun 2004 07:54:04 +0000 (GMT) Received: from tx0.oucs.ox.ac.uk (tx0.oucs.ox.ac.uk [129.67.1.163]) by svr1.postgresql.org (Postfix) with ESMTP id F2A99D1B172 for ; Fri, 11 Jun 2004 04:54:01 -0300 (ADT) Received: from scan0.oucs.ox.ac.uk ([129.67.1.162] helo=localhost) by tx0.oucs.ox.ac.uk with esmtp (Exim 4.24) id 1BYgrS-0003Uh-F5 for pgsql-sql@postgresql.org; Fri, 11 Jun 2004 08:54:02 +0100 Received: from rx0.oucs.ox.ac.uk ([129.67.1.161]) by localhost (scan0.oucs.ox.ac.uk [129.67.1.162]) (amavisd-new, port 25) with ESMTP id 13183-10 for ; Fri, 11 Jun 2004 08:54:02 +0100 (BST) Received: from smtp0.herald.ox.ac.uk ([163.1.0.246]) by rx0.oucs.ox.ac.uk with esmtp (Exim 4.24) id 1BYgrS-0003Ua-1E; Fri, 11 Jun 2004 08:54:02 +0100 Received: from mizar.oucs.ox.ac.uk ([163.1.15.107]) by smtp0.herald.ox.ac.uk with esmtp (Exim 3.35 #1) id 1BYgrS-00042f-3y; Fri, 11 Jun 2004 08:54:02 +0100 Received: from stephen by mizar.oucs.ox.ac.uk with local (Exim 3.36 #1 (Debian)) id 1BYgrS-0001Ko-00; Fri, 11 Jun 2004 08:54:02 +0100 Date: Fri, 11 Jun 2004 08:54:02 +0100 From: Stephen Quinney To: Chris Gamache Cc: pgsql-sql@postgresql.org Subject: Re: Converting integer to binary Message-ID: <20040611075402.GA4887@computing-services.oxford.ac.uk> References: <20040610182756.GA22247@wolff.to> <20040610202415.89117.qmail@web13804.mail.yahoo.com> <20040610222731.GA26006@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040610222731.GA26006@wolff.to> X-Operating-System: Linux mizar 2.6.6 x-gpg-fingerprint: F934 244D 4E26 DBDE C9EF BFB7 2131 9B94 4C1A 5BE5 x-gpg-key: wwwkeys.uk.pgp.net User-Agent: Mutt/1.5.5.1+cvs20040105i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Level: * X-Archive-Number: 200406/96 X-Sequence-Number: 18041 On Thu, Jun 10, 2004 at 05:27:31PM -0500, Bruno Wolff III wrote: > On Thu, Jun 10, 2004 at 13:24:15 -0700, > Chris Gamache wrote: > > Following up on the cast to bit idea, he could do something like > casting to bit(32). I don't think there is an easy way to get this > cast to string, so it may not completely solve his problem, depending > on what he was going to do with the binary representation. On teh other > hand, for some things a bit field might be more useful than a string. > > area=> select 6::bit(32); > bit > ---------------------------------- > 00000000000000000000000000000110 > (1 row) That would probably work for me in this case as I am interfacing to postgresql via the Perl DBI layer. With perl reading out that field would give me a string representation. Thanks for the tips, Stephen Quinney