Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6NB3Uf88112 for ; Mon, 23 Jul 2001 07:03:30 -0400 (EDT) (envelope-from dev@archonet.com) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 2.12 #1) id 15OdUm-000BlE-0W; Mon, 23 Jul 2001 12:03:28 +0100 Received: from client (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with SMTP id 96C81139A8; Mon, 23 Jul 2001 12:00:15 +0100 (BST) Message-ID: <003a01c11366$a6495420$1001a8c0@archonet.com> From: "Richard Huxton" To: "Gary Stainburn" , "pgsql-sql" References: <01072310180800.26815@gary.ringways.co.uk> Subject: Re: where'd the spaces come from Date: Mon, 23 Jul 2001 12:00:11 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200107/300 X-Sequence-Number: 4103 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