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 213CCD1B376 for ; Thu, 10 Jun 2004 15:22:13 -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 77442-01 for ; Thu, 10 Jun 2004 18:22:10 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 3B7D1D1B383 for ; Thu, 10 Jun 2004 15:22:05 -0300 (ADT) Received: (qmail 22273 invoked by uid 500); 10 Jun 2004 18:27:56 -0000 Date: Thu, 10 Jun 2004 13:27:56 -0500 From: Bruno Wolff III To: Stephen Quinney Cc: pgsql-sql@postgresql.org Subject: Re: Converting integer to binary Message-ID: <20040610182756.GA22247@wolff.to> Mail-Followup-To: Stephen Quinney , pgsql-sql@postgresql.org References: <20040610135240.GD27245@computing-services.oxford.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040610135240.GD27245@computing-services.oxford.ac.uk> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/91 X-Sequence-Number: 18036 On Thu, Jun 10, 2004 at 14:52:41 +0100, Stephen Quinney wrote: > > I have searched around but I cannot see any standard way in PostgreSQL > to convert from an integer into a binary representation. > > Now I have an algorithm to do it so I could write an SQL function, I > guess. If there's a standard way to do it though that would be quite nice. There doesn't seem to currently be a function that does this. to_char would be the logical place since that is what is used to convert various numeric types to strings with a decimal representation.