X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 9F5F49FA159 for ; Sat, 10 Jun 2006 15:33:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 16926-02 for ; Sat, 10 Jun 2006 15:32:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id D01B39F9AD3 for ; Sat, 10 Jun 2006 15:32:51 -0300 (ADT) Received: from andyshellam-gw.adsl.newnet.co.uk ([80.175.198.137]:4075 helo=[192.168.1.5]) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1Fp8GP-0002RF-Pq; Sat, 10 Jun 2006 19:32:50 +0100 Message-ID: <448B104E.7060106@andycc.net> Date: Sat, 10 Jun 2006 19:32:46 +0100 From: Andy Shellam Reply-To: andy@andycc.net Organization: AndyShellam.EU User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Michael Fuhr CC: pgsql-admin@postgresql.org Subject: Re: Number formatting References: <448B0C26.8070007@andycc.net> <20060610182823.GA91044@winnie.fuhr.org> In-Reply-To: <20060610182823.GA91044@winnie.fuhr.org> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/97 X-Sequence-Number: 22059 Perfect Thanks Michael :-) Andy Michael Fuhr wrote: > On Sat, Jun 10, 2006 at 07:15:02PM +0100, Andy Shellam wrote: >> So, what I'm trying to do is use a primary key to generate invoice >> numbers such as "INV0000001", "INV0000002" etc. Obviously a sequence >> generates the increments, but when I try formatting it, it adds a space >> at the beginning of the number. > > The FM modifier suppresses padding spaces. > > http://www.postgresql.org/docs/8.1/interactive/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIMEMOD-TABLE > > test=> SELECT 'INV' || to_char(123, 'FM0000000'); > ?column? > ------------ > INV0000123 > (1 row) >