Received: from relay.mail.insnet.cw.net (relay.mail.insnet.cw.net [213.38.238.97]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f72G6sf54489 for ; Thu, 2 Aug 2001 12:06:54 -0400 (EDT) (envelope-from gary.stainburn@ringways.co.uk) Received: from stan.ringways.co.uk ([213.38.87.130]) by relay.mail.insnet.cw.net (8.11.2/8.11.2) with ESMTP id f72Fv0H21772; Thu, 2 Aug 2001 16:57:00 +0100 (BST) Received: from garys.ringways.co.uk ([10.1.1.2] helo=gary.ringways.co.uk) by stan.ringways.co.uk with smtp (Exim 3.13 #1) id 15SKcr-0003YE-00; Thu, 02 Aug 2001 16:43:05 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Gary Stainburn Organization: Ringways Garages Ltd To: Bruce Momjian , Richard Huxton Subject: Re: where'd the spaces come from Date: Thu, 2 Aug 2001 16:56:26 +0100 X-Mailer: KMail [version 1.2] Cc: pgsql-sql References: <200108021550.f72FoW727322@candle.pha.pa.us> In-Reply-To: <200108021550.f72FoW727322@candle.pha.pa.us> MIME-Version: 1.0 Message-Id: <01080216562606.18757@gary.ringways.co.uk> Content-Transfer-Encoding: 8bit X-Archive-Number: 200108/14 X-Sequence-Number: 4235 Hi Bruce, a fix for what? If you're meaning the leading space, then the fix is in the followup post that I made to my original quiestion. i.e. psql -c "select to_char(12,'xFM000');" to_char --------- x012 (1 row) The 'FM' removes the space. Gary On Thursday 02 August 2001 4:50 pm, Bruce Momjian wrote: > Does anyone have a fix for this? > > > From: "Gary Stainburn" > > > > > psql -c "select t.tregion || '/' || to_char(t.tnumber,'000') || '-' || > > > to_char(m.mnumber,'00') as unitno from teams t, members m > > > where m.mteam = t.tid;" > > > unitno > > > ------------- > > > SW/ 041- 03 > > > SW/ 041- 05 > > > > Looks like a buglet in to_char()s handling of numbers (unless I > > misunderstand the way the formatting is supposed to work). > > > > select '[' || to_char(12,'x000') || ']'; > > ?column? > > ---------- > > [x 012] > > > > If you're running the current version, might be worth posting a bug > > report. You can work around it with something like: > > > > ... substr(to_char(t.tnumber,'000'),2,3) ... > > > > HTH > > > > - Richard Huxton > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000