Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f72FsWf50617 for ; Thu, 2 Aug 2001 11:54:32 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.10.1/8.10.1) id f72FoW727322; Thu, 2 Aug 2001 11:50:32 -0400 (EDT) From: Bruce Momjian Message-Id: <200108021550.f72FoW727322@candle.pha.pa.us> Subject: Re: where'd the spaces come from In-Reply-To: <003a01c11366$a6495420$1001a8c0@archonet.com> "from Richard Huxton at Jul 23, 2001 12:00:11 pm" To: Richard Huxton Date: Thu, 2 Aug 2001 11:50:32 -0400 (EDT) CC: Gary Stainburn , pgsql-sql X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200108/13 X-Sequence-Number: 4234 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 > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026